diff options
author | Martin Uecker <uecker@tugraz.at> | 2025-03-01 17:21:25 +0100 |
---|---|---|
committer | Martin Uecker <uecker@gcc.gnu.org> | 2025-03-19 08:50:44 +0100 |
commit | d9e834958e82219f836577da4ef8176aca2c7c9f (patch) | |
tree | 75a77babe4dded331ff3c945606c0c4553cb1178 /gcc/c | |
parent | 278715f255d07ae955cb2c0519b8f1233dfc6bf9 (diff) | |
download | gcc-d9e834958e82219f836577da4ef8176aca2c7c9f.zip gcc-d9e834958e82219f836577da4ef8176aca2c7c9f.tar.gz gcc-d9e834958e82219f836577da4ef8176aca2c7c9f.tar.bz2 |
c: Fix ICE in error recovery when checking struct compatibility [PR118061]
Return early when comparing two structures for compatibility
and the type of a member is erroneous.
PR c/118061
gcc/c/ChangeLog:
* c-typeck.cc (tagged_types_tu_compatible_p): Handle
errors in types of struct members.
gcc/testsuite/ChangeLog:
* gcc.dg/pr118061.c: New test.
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/c-typeck.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 11fa98d..1a39cbb 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -1933,6 +1933,9 @@ tagged_types_tu_compatible_p (const_tree t1, const_tree t2, ft2 = DECL_BIT_FIELD_TYPE (s2); } + if (TREE_CODE (ft1) == ERROR_MARK || TREE_CODE (ft2) == ERROR_MARK) + return false; + data->anon_field = !DECL_NAME (s1); data->pointedto = false; |