Set proper alignment on constants#28920
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r=me with the formatting nit fixed. |
|
@bors r=eddyb 00a79c0 |
There was a problem hiding this comment.
I think this belongs inside addr_of_mut, rather than here.
|
@bors r- @eefriedman Good point. |
|
Update as per the suggestion of @eefriedman. I also had to fix the string that identifies the gdb script section, which is used as a C string but had no terminating 0 byte. The alignment changes caused that bug to trigger an error in a codegen test. |
|
r? @eddyb |
There was a problem hiding this comment.
For clarity, you might want to use c_section_var_name.as_ptr() as *const _ below.
There was a problem hiding this comment.
For correctness even. Not sure where I lost that change (and even more confusing that it passed the test without it). Thanks!
For enum variants, the default alignment for a specific variant might be lower than the alignment of the enum type itself. In such cases we, for example, generate memcpy calls with an alignment that's higher than the alignment of the constant we copy from. To avoid that, we need to explicitly set the required alignment on constants. Fixes rust-lang#28912.
|
Updated to handle upgrading the alignment of constants that are shared between types with different alignment requirements. Thanks a lot @eefriedman! |
|
@bors r+ |
|
📌 Commit 6ad079e has been approved by |
For enum variants, the default alignment for a specific variant might be lower than the alignment of the enum type itself. In such cases we, for example, generate memcpy calls with an alignment that's higher than the alignment of the constant we copy from. To avoid that, we need to explicitly set the required alignment on constants. Fixes #28912.
For enum variants, the default alignment for a specific variant might be
lower than the alignment of the enum type itself. In such cases we, for
example, generate memcpy calls with an alignment that's higher than the
alignment of the constant we copy from.
To avoid that, we need to explicitly set the required alignment on
constants.
Fixes #28912.