re PR c/28502 (ICE with invalid declaration after definition)

PR c/28502
	* c-decl.c (validate_proto_after_old_defn): Return false on invalid
	argument.

	* gcc.dg/proto-1.c: New test.

From-SVN: r115957
This commit is contained in:
Volker Reichelt 2006-08-05 23:41:22 +00:00 committed by Volker Reichelt
parent c0bcacec2d
commit ffc44ab683
4 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2006-08-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/28502
* c-decl.c (validate_proto_after_old_defn): Return false on invalid
argument.
PR c/27721
* c-typeck.c (build_modify_expr): Test earlier for non-lvalues.

View File

@ -1083,8 +1083,14 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
for (;;)
{
tree oldargtype = TYPE_MAIN_VARIANT (TREE_VALUE (oldargs));
tree newargtype = TYPE_MAIN_VARIANT (TREE_VALUE (newargs));
tree oldargtype = TREE_VALUE (oldargs);
tree newargtype = TREE_VALUE (newargs);
if (oldargtype == error_mark_node || newargtype == error_mark_node)
return false;
oldargtype = TYPE_MAIN_VARIANT (oldargtype);
newargtype = TYPE_MAIN_VARIANT (newargtype);
if (END_OF_ARGLIST (oldargtype) && END_OF_ARGLIST (newargtype))
break;

View File

@ -1,5 +1,8 @@
2006-08-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/28502
* gcc.dg/proto-1.c: New test.
PR c/27721
* gcc.dg/lvalue-4.c: New test.

View File

@ -0,0 +1,5 @@
/* PR c/28502 */
/* { dg-do compile } */
void foo() {} /* { dg-error "previous" } */
void foo(void[]); /* { dg-error "array of voids" } */