PR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible function redeclaration

gcc/c-family/ChangeLog:

	PR c/97463
	* c-warn.c (warn_parm_ptrarray_mismatch): Move null test earlier.

gcc/testsuite/ChangeLog:

	PR c/97463
	* gcc.dg/pr97463.c: New test.
This commit is contained in:
Martin Sebor 2020-10-23 12:30:20 -06:00
parent c7c4a2787b
commit 7991e96323
2 changed files with 11 additions and 4 deletions

View File

@ -3177,14 +3177,14 @@ warn_parm_ptrarray_mismatch (location_t origloc, tree curparms, tree newparms)
{
curtyp = TREE_TYPE (curtyp);
newtyp = TREE_TYPE (newtyp);
if (!newtyp)
/* Bail on error. */
return;
}
while (TREE_CODE (curtyp) == POINTER_TYPE
&& TREE_CODE (newtyp) == POINTER_TYPE);
if (!newtyp)
/* Bail on error. */
return;
if (TREE_CODE (curtyp) != ARRAY_TYPE
|| TREE_CODE (newtyp) != ARRAY_TYPE)
{

View File

@ -0,0 +1,7 @@
/* PR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible
function redeclaration
{ dg-do compile }
{ dg-options "-Wall" } */
void f (void**);
void f (int n) { } // { dg-error "conflicting types" }