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

x64Emitter: Fix unaligned store UBSAN errors #14018

Merged
merged 1 commit into from
Jan 30, 2021

Conversation

glebm
Copy link
Contributor

@glebm glebm commented Jan 30, 2021

This compiles to the same assembly as before even without optimizations and avoids UB (https://godbolt.org/z/4G5edM).

While the UB here is benign, this improves signal-to-noise ratio of UBSAN errors.

Note that Clang, GCC, and MSVC, all compile the standards-compliant way to the same assembly as the "fast" way even without optimizations enabled: https://godbolt.org/z/gZg2Fk (the link uses -O2, you can confirm by changing to -O0)

Fixes #14005

This compiles to the same assembly as before even without optimizations and avoids UB.

https://godbolt.org/z/4G5edM

While the UB here is benign, this improves signal-to-noise ratio of UBSAN errors.

Fixes hrydgard#14005
@hrydgard hrydgard added this to the v1.11.0 milestone Jan 30, 2021
@hrydgard hrydgard merged commit 53b249f into hrydgard:master Jan 30, 2021
@glebm glebm deleted the fix-ubsan-warning-x64-emitter branch January 30, 2021 14:39
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

Successfully merging this pull request may close these issues.

[UBSAN] Common/x64Emitter.h: store to misaligned address (lines 364-366, 504)
2 participants