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

Comments

Projects
None yet
2 participants
@xxuejie
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

This comment has been minimized.

Owner

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 kripken closed this in eb6144f Nov 13, 2012

@kripken

This comment has been minimized.

Owner

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