aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMartin Uecker <uecker@tugraz.at>2024-01-23 13:33:34 +0100
committerMartin Uecker <uecker@tugraz.at>2024-01-31 20:56:01 +0100
commitf6ba433d3c30c20fadd393eed31617a4da81789c (patch)
tree3179c31e88149b4adae0c735df25444fdebb5584 /gcc/c
parent3fed1609f61088c4e607d6987d86579f684bf4dc (diff)
downloadgcc-f6ba433d3c30c20fadd393eed31617a4da81789c.zip
gcc-f6ba433d3c30c20fadd393eed31617a4da81789c.tar.gz
gcc-f6ba433d3c30c20fadd393eed31617a4da81789c.tar.bz2
Fix ICE with -g and -std=c23 when forming composite types [PR113438]
Set TYPE_STUB_DECL to an artificial decl when creating a new structure as a composite type. PR c/113438 gcc/c/ * c-typeck.cc (composite_type_internal): Set TYPE_STUB_DECL. gcc/testsuite/ * gcc.dg/pr113438.c: New test.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-typeck.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 12d1a5a..3b519c4 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -585,6 +585,11 @@ composite_type_internal (tree t1, tree t2, struct composite_cache* cache)
/* Setup the struct/union type. Because we inherit all variably
modified components, we can ignore the size expression. */
tree expr = NULL_TREE;
+
+ /* Set TYPE_STUB_DECL for debugging symbols. */
+ TYPE_STUB_DECL (n) = pushdecl (build_decl (input_location, TYPE_DECL,
+ NULL_TREE, n));
+
n = finish_struct(input_location, n, fields, attributes, NULL, &expr);
n = qualify_type (n, t1);