From e49a760f33541c07a605bdbd64ca15c56e398b6c Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Fri, 19 Mar 2010 15:52:41 -0700 Subject: [PATCH] re PR c/43211 (ICE with incomplete type in function argument) 2010-03-19 Andrew Pinski PR C/43211 * c-decl.c (grokparms): Set arg_types to NULL_TREE if there was an error. 2010-03-19 Andrew Pinski 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 --- gcc/ChangeLog | 5 +++++ gcc/c-decl.c | 2 ++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/pr18809-1.c | 2 +- gcc/testsuite/gcc.dg/pr43211.c | 15 +++++++++++++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr43211.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index abf7e3fe95f4..8684997b9e26 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-03-19 Andrew Pinski + + PR C/43211 + * c-decl.c (grokparms): Set arg_types to NULL_TREE if there was an error. + 2010-03-19 Bernd Schmidt PR rtl-optimization/42258 diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 87fb19a3d471..fed04dca9e98 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4701169c3934..8e5ca1fe14e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-03-19 Andrew Pinski + + 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 PR rtl-optimization/42258 diff --git a/gcc/testsuite/gcc.dg/pr18809-1.c b/gcc/testsuite/gcc.dg/pr18809-1.c index 27f2be9ef042..3b6e8cc1852d 100644 --- a/gcc/testsuite/gcc.dg/pr18809-1.c +++ b/gcc/testsuite/gcc.dg/pr18809-1.c @@ -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); } diff --git a/gcc/testsuite/gcc.dg/pr43211.c b/gcc/testsuite/gcc.dg/pr43211.c new file mode 100644 index 000000000000..1549619ed162 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr43211.c @@ -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; +} +