Repository navigation
Look up an operand's name only when it is an identifier #350
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: master
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 |
|---|---|---|
|
|
@@ -13049,6 +13049,16 @@ EOF | |
|
|
||
| # Extended compound literal tests (C99-style brace initialization) | ||
|
|
||
| # An operand that opens with a brace is an array literal. It names nothing, so | ||
| # no identifier lookup may decide how it parses. | ||
| try_ 0 << EOF | ||
| int main(void) | ||
| { | ||
| long long v = {}; | ||
| return (int) v; | ||
| } | ||
| EOF | ||
|
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. Nonblocking: please add a compile-error regression for the other path this fix protects: try_compile_error << EOF
int main(void) { return +; }
EOFI verified that the unpatched compiler, built with |
||
|
|
||
| # Additional struct compound literals with different field counts | ||
| try_ 12 << EOF | ||
| typedef struct { int a; int b; int c; int d; } quad_t; | ||
|
|
||
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.
Nonblocking documentation suggestion: explicitly connect the empty name to the built-in comparisons below. Guarding the lookups alone would still leave those
strcmp()calls reading an uninitialized buffer, so theelseis necessary.For example:
The current implementation is correct; this explains why both parts of the fix must stay together.