Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with fixed size arrays in structs #3

Closed
hazedtower opened this issue Apr 17, 2011 · 1 comment
Closed

Problem with fixed size arrays in structs #3

hazedtower opened this issue Apr 17, 2011 · 1 comment

Comments

@hazedtower
Copy link

The javascript generated by emscripten from the following C program prints "0 0", instead of "1.00000 1.00000". It appears the offset of fixed size arrays in structs is sometimes wrong (zero).



#include <stdio.h>
struct {   
    int x;
    double y[10];
    double z[10];
} commonblock;

int main(int argc, char **argv)
{
    int i;
    for (i = 0; i < 10; ++i) {
        commonblock.y[i] = 1;
        commonblock.z[i] = 1;
    }

    printf("%f %f\n", commonblock.y[0], commonblock.z[0]);
    return 0;
}

Code like this was obtained by converting a Fortran program to C. I worked around this issue by putting every fixed size array in its own common block.

@kripken
Copy link
Member

kripken commented Apr 18, 2011

Fixed by f72cf76. We weren't properly finalizing parameters to getelementptr.

Thanks for the bug report!

@kripken kripken closed this as completed Apr 18, 2011
Becavalier added a commit to Becavalier/emscripten that referenced this issue May 29, 2018
# This is the 1st commit message:
Complete 'TODO: use TextDecoder'

# This is the commit message emscripten-core#2:

Fix format.

# This is the commit message emscripten-core#3:

Fix ci.
tlively pushed a commit to tlively/emscripten that referenced this issue Mar 23, 2022
steveisok pushed a commit to steveisok/emscripten that referenced this issue Sep 18, 2023
sbc100 pushed a commit that referenced this issue Jun 17, 2024
Contains 2 emscripten-glfw version with following release notes:

#### 3.4.0.20240617 - 2024-06-17 | emscripten TBD

- Fixed [#3](pongasoft/emscripten-glfw#3): glfwGetKey must return one of `GLFW_PRESS` or `GLFW_RELEASE`

#### 3.4.0.20240616 - 2024-06-16 | emscripten TBD

- Implemented `glfwGetClipboardString`. Note that due to the async (and restrictive) nature of the 
  `navigator.clipboard.readText` call, this synchronous API returns whatever was set via a previous call
  to `glfwSetClipboardString` and ignores the external clipboard entirely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants