]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix regression causing ICE for structs with VLAs [PR 112488]
authorMartin Uecker <uecker@tugraz.at>
Wed, 15 Nov 2023 08:22:55 +0000 (09:22 +0100)
committerMartin Uecker <uecker@tugraz.at>
Mon, 11 Dec 2023 22:20:02 +0000 (23:20 +0100)
commit6cf9654c3b06c076502a39a3bf2222dd6e43b73b
treef6f44656e328c4b3e35dbc49f8a74f0c24df48e5
parent453e0f45a49f425992bc47ff8909ed8affc29d2e
Fix regression causing ICE for structs with VLAs [PR 112488]

A previous patch that fixed several ICEs related to size expressions
of VM types (PR c/70418, ...) caused a regression for structs where
a DECL_EXPR is not generated anymore although reqired.  We now call
add_decl_expr introduced by the previous patch from finish_struct.
The function is revised with a new argument to not set the TYPE_NAME
for the type to the DECL_EXPR in this specific case.

PR c/112488

gcc/c
* c-decl.cc (add_decl_expr): Revise.
(finish_struct): Create DECL_EXPR.
* c-parser.cc (c_parser_struct_or_union_specifier): Call
finish_struct with expression for VLA sizes.
* c-tree.h (finish_struct): Add argument.

gcc/testsuite
* gcc.dg/pr112488-1.c: New test.
* gcc.dg/pr112488-2.c: New test.
* gcc.dg/pr112898.c: New test.
* gcc.misc-tests/gcov-pr85350.c: Adapt.
gcc/c/c-decl.cc
gcc/c/c-parser.cc
gcc/c/c-tree.h
gcc/testsuite/gcc.dg/pr112488-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr112488-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr112898.c [new file with mode: 0644]
gcc/testsuite/gcc.misc-tests/gcov-pr85350.c