-
Notifications
You must be signed in to change notification settings - Fork 14
"Cannot generate unaligned atomic load" #72
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
Comments
The assertion is coming from the non-AVR-specific module
|
Commenting out that assertion, the above IR compiles to
but I don't have the mental capacity right now to understand that. I do see lots of |
I think this may be somehow related to the data layout, as that specifies alignments for all types. I know the data layout in the current AVR-rust is slightly different to the data layout in upstream LLVM trunk. |
Upstream LLVM is wrong because it thinks there's alignment on AVR. I'm afraid that |
The current LLVM data layout says that This isn't an area I know too much about, but if a type is aligned to its own size, isn't that the same as saying there is no alignment?
|
No, because e.g. 32-bit alignment for 32-bit words would mean that you can't have a 32-bit word starting at an address not divisible by 4. No alignment means you can have a 32-bit word at any address. |
I see. I'm looking at the reference now, a quick glance gives me the impression that if we set alignment to Your definition of alignment would mean that all addresses must be divisible by one in this case, and therefore it would be equivalent to no alignment? |
Yes, exactly. But I thought that's what's already in our branch of LLVM, ever since avr-rust/llvm@f499a13. |
Interesting, I'm not sure why that isn't upstreamed, it really should be. |
OK but still, the issue here is that on "our" branch, where alignment is correctly 1-byte for everything, the linked assertion fails because it assumes (for some reason) that atomic access must be aligned:
Here, |
Bummed to find that there is no |
I can't recall what specific bug caused us to remove the |
The commit that removes
So try reverting that change. |
As a point, I tried just reverting, and it generates the same error as #26. I don't think it's related to this issue. I've also created avr-rust/libcore#1 to track this from the libcore side. |
Agree with Shep, I will revert and push |
with 5b04cc064b4e083e80e674c8092e773f6c0220af I get this:
:-( |
There is discussion about this issue prompted by Gergo on llvm-dev General summary:
|
Have a patch for this locally, will post to reviews.llvm.org when I've run tests. |
And here's the review https://reviews.llvm.org/D39946 I do not know the reviewers of this patch so I am unsure how long it'll take to get committed, but if it's more than a few days we can cherry-pick it to avr-rust anyway temporarily until it's in LLVM trunk. |
I will cherry-pick the un-upstreamed fix into avr-rust/llvm anyway, just so the compiler is more stable for avr-rust users. Once D39946 lands, we should revert the old commit and cherry-pick the new one (assuming there are code review changes). |
This cherry-picks a not-yet-upstreamed commit that fixes an AVR assertion error. See the LLVM commit for more details.
Cherry-picked the patch into avr-rust/llvm@0149e8b and updated the LLVM submodule in 48f2d58. |
This should now be fixed - I have raised #86 so we don't forget to pull in the upstream patch when it lands. |
One of the changes in
libcore-mini
is the removal of thesync
module. Originally, it seemed #58 was the cause of needing to remove it, but now that that one is closed, it turns out it still can't be compiled.The offending Rust code, stripped to its essentials, looks like this:
Further stripping down the resulting IR we get
which results in the error message
The text was updated successfully, but these errors were encountered: