From ba6373a39782139789f0eeba7c0e607ec6dfb477 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 28 Aug 2020 08:26:32 -0600 Subject: PR c/96596 - ICE in match_builtin_function_types on a declaration of a built-in with invalid array argument gcc/c/ChangeLog: PR c/96596 * c-decl.c (match_builtin_function_types): Avoid dealing with erroneous argument type. gcc/testsuite/ChangeLog: PR c/96596 * gcc.dg/Wbuiltin-declaration-mismatch-16.c: New test. --- gcc/c/c-decl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 5d6b504..190c00b 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -1712,7 +1712,10 @@ match_builtin_function_types (tree newtype, tree oldtype, return NULL_TREE; tree oldtype = TYPE_MAIN_VARIANT (TREE_VALUE (oldargs)); - tree newtype = TYPE_MAIN_VARIANT (TREE_VALUE (newargs)); + tree newtype = TREE_VALUE (newargs); + if (newtype == error_mark_node) + return NULL_TREE; + newtype = TYPE_MAIN_VARIANT (newtype); if (!types_close_enough_to_match (oldtype, newtype)) return NULL_TREE; -- cgit v1.1