-
Notifications
You must be signed in to change notification settings - Fork 886
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
Incorrect small struct passing in 5th argument position #127
Comments
Ah, it's actually in Line 1333 in 90d1f7f
<= not < . The other checks that are similar are doing post-increments, so they're checking before the registers-to-be-used have been added.
|
Oh, but it looks like there's a second problem near this code too! In this case the
|
I think maybe |
This was incorrect (again!) for Windows. I discovered the chibicc code at HEAD also has some problems in this area rui314/chibicc#127. I think Windows is correct(er) now, and made a light attempt at SysV, but I'm not sure about SysV. Probably needs some more tests where the one side of the caller/callee is the host compiler (i.e. gcc/clang) to confirm that we don't just have "two wrongs" masking an error in calling convention.
Another repro with 1 struct param:
I guess the workaround is to never pass structs. |
@fuhsnn TokTok/c-toxcore#2624 it works perfectly. I'm adding it to our CI to make sure it keeps working. |
I found this prints "1 2 3 4 N" where N is something random (not 99).
This error doesn't occur if only 3 ints are passed before the struct, or if 5 are, so I guess it's probably an edge case in
push_args()
, or maybe in the setup inND_FUNCALL
.The text was updated successfully, but these errors were encountered: