https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108375
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Martin Uecker <uec...@gcc.gnu.org>: https://gcc.gnu.org/g:47821ba07a19b672d3cba351a03af2b122e02213 commit r13-6128-g47821ba07a19b672d3cba351a03af2b122e02213 Author: Martin Uecker <uec...@tugraz.at> Date: Wed Feb 15 10:54:00 2023 +0100 C: Detect all variably modified types [PR108375] Some variably modified types were not detected correctly. Define C_TYPE_VARIABLY_MODIFIED via TYPE_LANG_FLAG 6 in the CFE. This flag records whether a type is variably modified and is set for all such types including arrays with variably modified element type or structures and unions with variably modified members. This is then used to detect such types in the C FE and middle-end (via the existing language hook). gcc/c/ChangeLog: PR c/108375 * c-decl.cc (decl_jump_unsafe): Use c_type_variably_modified_p. (diagnose_mismatched_decl): Dito. (warn_about_goto): Dito: (c_check_switch_jump_warnings): Dito. (finish_decl): Dito. (finish_struct): Dito. (grokdeclarator): Set C_TYPE_VARIABLY_MODIFIED. (finish_struct): Set C_TYPE_VARIABLY_MODIFIED. * c-objc-common.cc (c_var_mod_p): New function. (c_var_unspec_p): Remove. * c-objc-common.h: Set lang hook. * c-parser.cc (c_parser_declararion_or_fndef): Use c_type_variably_modified_p. (c_parser_typeof_specifier): Dito. (c_parser_has_attribute_expression): Dito. (c_parser_generic_selection): Dito. * c-tree.h: Define C_TYPE_VARIABLY_MODIFIED and define c_var_mode_p. * c-typeck.cc: Remove c_vla_mod_p and use C_TYPE_VARIABLY_MODIFIED. gcc/testsuite/ChangeLog: PR c/108375 * gcc.dg/pr108375-1.c: New test. * gcc.dg/pr108375-2.c: New test.