Skip to content

Conversation

@gaborcsardi
Copy link
Member

Thanks UBSAN.

Ideally I would benchmark this, because it might be faster to
use unaligned addresses if the compiler and the arch supports it.
The largest 64 bit (unsigned) integers cannot be exactly
represented as doubles.
So we actually see the errors.
Real limit is platform dependent, so use a conservative
value.
For min and max, there is no platform-independent
boundary, even though 'double' is supposed to be the
same everywhere.
@gaborcsardi gaborcsardi changed the title Fix a misaligned address Fix undefined behavior Feb 4, 2025
@gaborcsardi gaborcsardi merged commit 24e0771 into main Feb 4, 2025
13 checks passed
@gaborcsardi gaborcsardi deleted the fix/ubsan branch February 4, 2025 21:18
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.

2 participants