On Thu, May 14, 2026 at 04:12:40PM -0700, Andi Kleen wrote:
> From: Andi Kleen <[email protected]>
>
> A compound statement didn't reset the musttail state after the statement
> with the attribute, which lead to bogus errors later. Always reset it.
>
> Proposed for trunk and gcc-15 / 16.
>
> PR c/124532
>
> gcc/c/ChangeLog:
>
> * c-parser.cc (struct attr_state): Add reset method.
> (c_parser_compound_statement_nostart): Rename a to astate.
> Reset state before iterating statements.
>
> gcc/testsuite/ChangeLog:
>
> * c-c++-common/pr124532.c: New test.
> ---
> gcc/c/c-parser.cc | 13 ++++++++++---
> gcc/testsuite/c-c++-common/pr124532.c | 13 +++++++++++++
> 2 files changed, 23 insertions(+), 3 deletions(-)
> create mode 100644 gcc/testsuite/c-c++-common/pr124532.c
>
> diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
> index 07c7900c332e..0dd3e052b0e9 100644
> --- a/gcc/c/c-parser.cc
> +++ b/gcc/c/c-parser.cc
> @@ -1795,6 +1795,8 @@ struct attr_state
> {
> /* True if we parsed a musttail attribute for return. */
> bool musttail_p;
> +
> + void reset() { musttail_p = false; }
Missing space before ()
Jakub