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.
This commit is contained in:
parent
cb3c3d6331
commit
ba6373a397
2 changed files with 16 additions and 1 deletions
|
@ -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;
|
||||
|
|
12
gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-16.c
Normal file
12
gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-16.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* PR c/96596 - ICE on a declaration of a built-in with invalid array
|
||||
argument
|
||||
{ dg-do compile } */
|
||||
|
||||
void __builtin_abort (int[foo]); /* { dg-error "'foo' undeclared" } */
|
||||
void __builtin_trap (int[__SIZE_MAX__]); /* { dg-error "size of unnamed array is too large" } */
|
||||
void __builtin_unreachable (int[][]); /* { dg-error "array type has incomplete element type" } */
|
||||
|
||||
void __builtin_exit (int, int[+]); /* { dg-error "expected expression before" } */
|
||||
|
||||
/* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch" } */
|
||||
|
Loading…
Add table
Reference in a new issue