https://gcc.gnu.org/g:070512acf67a1621069c1e620d6d7e6659c17024
commit r17-4149-g070512acf67a1621069c1e620d6d7e6659c17024 Author: Richard Biener <[email protected]> Date: Thu Sep 10 10:11:28 2026 +0200 Ignore the has_volatile_ops marker during GIMPLE parsing The following makes the GIMPLE parser handle ... ={v} ... which is how we dump gimple_has_volatile_ops which is a flag that caches information that's available by other means as it is computed by the operand scanner. It's not necessary for parsing, so instead of parsing and ignoring it we could omit it from -gimple dumps, but it does provide visual information to the reader. This allows more -gimple dumps to be consumed by the GIMPLE frontend without editing. gcc/c/ * gimple-parser.cc (c_parser_gimple_statement): Parse but ignore {v} marker on assignments. Diff: --- gcc/c/gimple-parser.cc | 16 ++++++++++++++++ gcc/testsuite/gcc.dg/gimplefe-61.c | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc index 7d374dd66b03..0e0c8ba673b0 100644 --- a/gcc/c/gimple-parser.cc +++ b/gcc/c/gimple-parser.cc @@ -806,6 +806,22 @@ c_parser_gimple_statement (gimple_parser &parser, gimple_seq *seq) if (! c_parser_require (parser, CPP_EQ, "expected %<=%>")) return; + /* Eat and ignore {v} right after the =, the has_volatile_ops is + redundant and re-computed by the operand scanner. */ + if (c_parser_next_token_is (parser, CPP_OPEN_BRACE) + && !(c_parser_peek_token (parser)->flags & PREV_WHITE) + && c_parser_peek_2nd_token (parser)->type == CPP_NAME + && !(c_parser_peek_2nd_token (parser)->flags & PREV_WHITE) + && strcmp ("v", IDENTIFIER_POINTER + (c_parser_peek_2nd_token (parser)->value)) == 0 + && c_parser_peek_nth_token (parser, 3)->type == CPP_CLOSE_BRACE + && !(c_parser_peek_nth_token (parser, 3)->flags & PREV_WHITE)) + { + c_parser_consume_token (parser); + c_parser_consume_token (parser); + c_parser_consume_token (parser); + } + /* Cast expression. */ if (c_parser_next_token_is (parser, CPP_OPEN_PAREN) && c_token_starts_typename (c_parser_peek_2nd_token (parser))) diff --git a/gcc/testsuite/gcc.dg/gimplefe-61.c b/gcc/testsuite/gcc.dg/gimplefe-61.c new file mode 100644 index 000000000000..ec11ee9bcee2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gimplefe-61.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fgimple" } */ + +volatile int i; + +void __GIMPLE foo () +{ + i ={v} 1; +}
