Skip to content
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

Add +strict-align to .cargo/config #12

Closed
andre-richter opened this issue Jan 21, 2019 · 4 comments
Closed

Add +strict-align to .cargo/config #12

andre-richter opened this issue Jan 21, 2019 · 4 comments

Comments

@andre-richter
Copy link
Member

andre-richter commented Jan 21, 2019

Prevents issues like #10

@andre-richter
Copy link
Member Author

@digitalstreamio this is now upstream and should land in the nightly toolchain sometime soon.

Prevents #10

@binaryfields
Copy link

Awesome. I was just hit by this again while trying to copy data from device memory used by my sd card handling code to my app level state.

I can certainly appreciate the generated code no longer halting the cpu ;).

Out of curiosity though, are there any downsides to turning this on?

@binaryfields
Copy link

Also, I will gladly give it a spin in a day or two once nightly picks it up. Cheers!

@andre-richter
Copy link
Member Author

With the option turned on, the compiler circumvents miss-aligned accesses by generating code in a way that it doesn't fail, eg using two 32bit accesses instead of one 64bit access if your operate on an address where modulo 8 != 0. This will cause your code to function, but probably it won't be the fastest possible code.

So you gain that your code doesn't crash and trade It for potentially slight performance hits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants