aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMartin Uecker <uecker@tugraz.at>2024-03-28 19:15:40 +0100
committerMartin Uecker <uecker@tugraz.at>2024-04-03 00:09:36 +0200
commit871bb5ad2dd56343d80b6a6d269e85efdc9999e5 (patch)
treee6900f2c3a60585d6091ee1488cd0d2052bbab83 /gcc/c
parente945d322fcbc68f91388b1d1297bdf6a6c6fcbaa (diff)
downloadgcc-871bb5ad2dd56343d80b6a6d269e85efdc9999e5.zip
gcc-871bb5ad2dd56343d80b6a6d269e85efdc9999e5.tar.gz
gcc-871bb5ad2dd56343d80b6a6d269e85efdc9999e5.tar.bz2
Fix ICE with -g and -std=c23 related to incomplete types [PR114361]
We did not copy TYPE_CANONICAL to the incomplete variants when completing a structure. PR c/114361 gcc/c/ * c-decl.cc (finish_struct): Set TYPE_CANONICAL when completing strucute types. gcc/testsuite/ * gcc.dg/pr114361.c: New test. * gcc.dg/c23-tag-incomplete-1.c: New test. * gcc.dg/c23-tag-incomplete-2.c: New test.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-decl.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index c747abe..f2083b9 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -9722,6 +9722,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t);
C_TYPE_VARIABLY_MODIFIED (x) = C_TYPE_VARIABLY_MODIFIED (t);
C_TYPE_INCOMPLETE_VARS (x) = NULL_TREE;
+ TYPE_CANONICAL (x) = TYPE_CANONICAL (t);
}
/* Update type location to the one of the definition, instead of e.g.