-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[clang][ExprConstant] Reject integral casts of addr-label-diffs... #171437
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
|
|
||
| // CHECK: | |-value: AddrLabelDiff &&l2 - &&l1 | ||
| int Test(void) { | ||
| constexpr char ar = &&l2 - &&l1; | ||
| constexpr long long ar = &&l2 - &&l1; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep a test where the result is narrowed to show that we reject those, or is that already covered elsewhere?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in int b(void) {
static int ar = &&l2 - &&l1;
l1:
return 10;
l2:
return 11;
}
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not what I was after, I meant a Sema test showing we diagnose:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I guess we don't? int b(void) {
static unsigned __int128 ar = &&l2 - &&l1; // error
l1:
return 10;
l2:
return 11;
}but we don't constant fold them.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was basing this off the patch description saying:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch rejects those casts in the same way we've always rejected widening casts :P |
||
| l1: | ||
| return 10; | ||
| l2: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.