pr124532: Reset musttail attribute in compound statements
GCC now resets the 'musttail' attribute after a statement in a compound statement, fixing bogus errors.
A compound statement in GCC’s C parser was not resetting the musttail attribute after encountering a statement with that attribute. This oversight led to spurious errors later in the compilation process. This commit fixes the issue by ensuring that the musttail state is always reset at the end of a compound statement, preventing incorrect error reporting.
In Details
The commit addresses PR124532 by adding a reset method to the attr_state struct in c-parser.cc. The c_parser_compound_statement_nostart function is modified to reset the attribute state before iterating through statements in a compound statement. This fixes an issue where the musttail attribute was not being properly reset, causing bogus errors. This is a bug fix related to the C language parser.
For Context
In C and C++, a compound statement is a block of code enclosed in curly braces {}. Attributes are annotations that can be applied to variables, functions, or other entities to provide additional information to the compiler. The musttail attribute is used to indicate that a function call must be implemented as a tail call (a specific type of function call optimization). This commit fixes a bug in GCC's C parser where the musttail attribute was not being correctly reset after a statement within a compound statement, leading to incorrect error messages.