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

va_arg cannot pass structs of union type or type with bit field correctly #705

Closed
xxuejie opened this issue Nov 13, 2012 · 2 comments
Closed

Comments

@xxuejie
Copy link
Contributor

xxuejie commented Nov 13, 2012

Please refer to this gist for the test source code: https://gist.github.com/4063456

This file works correctly when compiling directly using clang:

$ clang va-args-bug.c
$ ./a.out
The original address of a is: 0x12345678
The original type of b is: 9
The current address of a is: 0x12345678
The current type of b is: 9

But if we use emscripten to compile it, the results are not correct:

$ ./emcc va-args-bug.c
$ node a.out.js
The original address of a is: 0x12345678
The original type of b is: 9
The current address of a is: 0x10
The current type of b is: 24

This is very likely to be the reason of Issue #689. But I'm not 100% sure about this.

@kripken
Copy link
Member

kripken commented Nov 13, 2012

Thanks for the testcase! Looks like we do not handle byval varargs (a rare combination I am guessing) properly. Patch coming in a bit.

@kripken
Copy link
Member

kripken commented Nov 13, 2012

Hopefully this will indeed fix the original issue #689...

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