aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.cc
diff options
context:
space:
mode:
authorMartin Uecker <uecker@tugraz.at>2023-11-15 09:22:55 +0100
committerMartin Uecker <uecker@tugraz.at>2023-12-11 23:20:02 +0100
commit6cf9654c3b06c076502a39a3bf2222dd6e43b73b (patch)
treef6f44656e328c4b3e35dbc49f8a74f0c24df48e5 /gcc/c/c-parser.cc
parent453e0f45a49f425992bc47ff8909ed8affc29d2e (diff)
downloadgcc-6cf9654c3b06c076502a39a3bf2222dd6e43b73b.zip
gcc-6cf9654c3b06c076502a39a3bf2222dd6e43b73b.tar.gz
gcc-6cf9654c3b06c076502a39a3bf2222dd6e43b73b.tar.bz2
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.
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r--gcc/c/c-parser.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 5700ccc..0c30101 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -4087,7 +4087,7 @@ c_parser_struct_or_union_specifier (c_parser *parser)
ret.spec = finish_struct (struct_loc, type, nreverse (contents),
chainon (std_attrs,
chainon (attrs, postfix_attrs)),
- struct_info);
+ struct_info, &expr);
ret.kind = ctsk_tagdef;
ret.expr = expr;
ret.expr_const_operands = true;