-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix handling of FFI arguments #33872
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
Conversation
Hmm, it clashes with debuginfo. |
|
||
// FIXME: hacky lol? | ||
datum::Datum::new(lltmp, arg_ty, | ||
datum::Lvalue::new("datum::lvalue_scratch_datum")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work with debuginfo
, which wants an alloca
with no casts on top.
I would suggest giving it the alloca
before the cast and hope that it doesn't care about the type (debuginfo metadata should describe the actual value in the alloca
all by itself).
cc @michaelwoerister
Thanks for the quick fix @nagisa! |
ae8fc5c
to
0d2a84c
Compare
Added a check for debuginfo thing. All should work now. If there’s any hard-pressing nits, feel to fork and make another PR as I’m likely to be in bed for a while now. |
@bors r+ p=100 |
📌 Commit e0e50a4 has been approved by |
⌛ Testing commit e0e50a4 with merge 73fdf78... |
💔 Test failed - auto-linux-64-debug-opt |
Miscompiling the compiler, resulting in this for stage2
@alexcrichton Serious question: why is |
No particular reason, it just hasn't been done yet. We'd probably benefit from just setting it in the build system directly. |
@bors r=eddyb 2f0da79 |
Fix handling of FFI arguments r? @eddyb @nikomatsakis or whoever else. cc @alexcrichton @rust-lang/core The strategy employed here was to essentially change code we generate from ```llvm %s = alloca %S ; potentially smaller than argument, but never larger %1 = bitcast %S* %s to { i64, i64 }* store { i64, i64 } %0, { i64, i64 }* %1, align 4 ``` to ```llvm %1 = alloca { i64, i64 } ; the copy of argument itself store { i64, i64 } %0, { i64, i64 }* %1, align 4 %s = bitcast { i64, i64 }* %1 to %S* ; potentially truncate by casting to a pointer of smaller type. ```
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
@bors retry force |
Another case of #33844. |
Discussed on IRC and accepted for a beta backport |
r? @eddyb @nikomatsakis or whoever else.
cc @alexcrichton @rust-lang/core
The strategy employed here was to essentially change code we generate from
to