re PR c/43211 (ICE with incomplete type in function argument)

2010-03-19  Andrew Pinski  <andrew_pinski@caviumnetworks.com>

        PR C/43211
        * c-decl.c (grokparms): Set arg_types to NULL_TREE if there was an error.

2010-03-19  Andrew Pinski  <andrew_pinski@caviumnetworks.com>

        PR C/43211
        * gcc.dg/pr43211.c: New test.
        * gcc.dg/pr18809-1.c: Don't expect an error when calling foo.

From-SVN: r157585
This commit is contained in:
Andrew Pinski 2010-03-19 15:52:41 -07:00 committed by Andrew Pinski
parent fdb2c6841d
commit e49a760f33
5 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-03-19 Andrew Pinski <andrew_pinski@caviumnetworks.com>
PR C/43211
* c-decl.c (grokparms): Set arg_types to NULL_TREE if there was an error.
2010-03-19 Bernd Schmidt <bernd.schmidt@codesourcery.com>
PR rtl-optimization/42258

View File

@ -6118,6 +6118,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
TREE_VALUE (typelt) = error_mark_node;
TREE_TYPE (parm) = error_mark_node;
arg_types = NULL_TREE;
}
else if (VOID_TYPE_P (type))
{
@ -6138,6 +6139,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
error (errmsg);
TREE_VALUE (typelt) = error_mark_node;
TREE_TYPE (parm) = error_mark_node;
arg_types = NULL_TREE;
}
if (DECL_NAME (parm) && TREE_USED (parm))

View File

@ -1,3 +1,9 @@
2010-03-19 Andrew Pinski <andrew_pinski@caviumnetworks.com>
PR C/43211
* gcc.dg/pr43211.c: New test.
* gcc.dg/pr18809-1.c: Don't expect an error when calling foo.
2010-03-19 Bernd Schmidt <bernd.schmidt@codesourcery.com>
PR rtl-optimization/42258

View File

@ -7,4 +7,4 @@ void foo(enum E e) {} /* { dg-error "forward ref" "forward" } */
/* { dg-warning "declared" "declared" { target *-*-* } 6 } */
/* { dg-warning "scope" "scope" { target *-*-* } 6 } */
/* { dg-error "incomplete" "incomplete" { target *-*-* } 6 } */
void bar() { foo(0); } /* { dg-error "formal" } */
void bar() { foo(0); }

View File

@ -0,0 +1,15 @@
/* { dg-do compile } */
struct T;
struct S {
void (*bar)(struct S);
};
void bar(struct T t) {} /* { dg-error "" } */
void foo(struct S *s)
{
s->bar = bar;
}