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

Fix incorrect __builtin_constant_p test for c_align_to #18

Closed
wants to merge 1 commit into from

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jan 5, 2024

16 aligned to 8 or 16 will always be 16, so it is legal for __builtin_constant_p to return true here, and Clang indeed performs this optimization (while GCC does not).

Adjust the argument to 8, in which case the result of the expression is not a known constant.

16 aligned to 8 or 16 will always be 16, so it is legal for __builtin_constant_p to return true here, and Clang indeed performs this optimization (while GCC does not).

Adjust the argument to 8, in which case the result of the expression is not a known constant.
@dvdhrm
Copy link
Member

dvdhrm commented Jan 10, 2024

Clang performs the calculations for the set of possible inputs (2 in this case), and if they compare equal, it will consider it a constant expression? Impressive. Thanks for the heads-up!

Patch looks good! Thanks!

@dvdhrm
Copy link
Member

dvdhrm commented Jan 10, 2024

(Applied and pushed: adc78dde)

@dvdhrm dvdhrm closed this Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants