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

bitNot marked as NO_SANITIZE_UNDEFINED #48899

Merged
merged 2 commits into from
Apr 20, 2023
Merged

bitNot marked as NO_SANITIZE_UNDEFINED #48899

merged 2 commits into from
Apr 20, 2023

Conversation

vdimir
Copy link
Member

@vdimir vdimir commented Apr 18, 2023

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Close #48689

Some bit* functions doesn't work with float and throw an exception (see added test).
Another just covert floats to long and they are marked with NO_SANITIZE_UNDEFINED:

static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])

NO_SANITIZE_UNDEFINED static inline Result apply(A a [[maybe_unused]], B b [[maybe_unused]])

static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])

Also it's mentioned in the doc that we do float to long conversion

The result type is an integer with bits equal to the maximum bits of its arguments. If at least one of the arguments is signed, the result is a signed number. If an argument is a floating-point number, it is cast to Int64.

So, I believe this change is enough to fix UBSan assert /build/src/Functions/bitNot.cpp:25:41: runtime error: -inf is outside the range of representable values of type 'long'

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-not-for-changelog This PR should not be mentioned in the changelog label Apr 18, 2023
@Avogar Avogar self-assigned this Apr 18, 2023
@vdimir vdimir merged commit e105a6e into master Apr 20, 2023
138 checks passed
@vdimir vdimir deleted the vdimir/bitnot_ubsan branch April 20, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-not-for-changelog This PR should not be mentioned in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bitNot + ubsan : runtime error
3 participants