-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Handle constant "pointers" for __atomic_always_lock_free
/__atomic_is_lock_free
.
#99340
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2cb327b
Handle constant "pointers" for `__atomic_always_lock_free`/`__atomic_…
jyknight 3e6440c
Fix bug with implicit casts from non-pointer types.
jyknight 69e4fa4
fix clang-format issue.
jyknight 9ea6910
Merge remote-tracking branch 'origin/main' into atomic-lock-free-intptr
jyknight 4e3c491
Add release note
jyknight File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add some test coverage where the fake pointer is a constant expression but utter nonsense? e.g.,
(Just to make sure that the conversion correctly ignores these as valid hints.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, found a pre-existing bug:
_Static_assert(__atomic_always_lock_free(2, "string"), "");
triggers an assertion failure in clang at head because the type of"string"
is ConstantArrayType not PointerType, in this cast:llvm-project/clang/lib/AST/ExprConstant.cpp
Line 12960 in 83fbd79
The argument AST looks like:
I suppose it shouldn't do "IgnoreImpCasts", and instead only ignore a single level of BitCast ImplicitCastExpr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should undergo an actual lvalue to rvalue conversion on the operand so that we get all the expected conversions like decay. We have the same issue with: https://godbolt.org/z/P69vx5W8a or with the even-more-cursed: https://godbolt.org/z/zxTbbWbdc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does undergo such conversions already -- it's just that we were stripping them all off with the
IgnoreImpCasts
call. I've pushed what I think is a valid fix, PTAL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right, sorry for that!