On Wed, Jan 15, 2014 at 4:53 PM, Marek Polacek <pola...@redhat.com> wrote: > We ICE on the following (invalid) testcase, because the DECL_ARG_TYPE > is error_mark_node and useless_type_conversion_p doesn't check that > it operates on a type. > > Regtested/bootstrapped on x86_64-linux, ok for trunk/4.8/4.7?
Ok. Thanks, Richard. > 2014-01-15 Marek Polacek <pola...@redhat.com> > > PR middle-end/59827 > * cgraph.c (gimple_check_call_args): Don't use DECL_ARG_TYPE if > it is error_mark_node. > testsuite/ > * gcc.dg/pr59827.c: New test. > > --- gcc/cgraph.c.mp2 2014-01-15 14:24:53.235255954 +0100 > +++ gcc/cgraph.c 2014-01-15 14:52:28.818244290 +0100 > @@ -3035,6 +3035,7 @@ gimple_check_call_args (gimple stmt, tre > break; > arg = gimple_call_arg (stmt, i); > if (p == error_mark_node > + || DECL_ARG_TYPE (p) == error_mark_node > || arg == error_mark_node > || (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg)) > && !fold_convertible_p (DECL_ARG_TYPE (p), arg))) > --- gcc/testsuite/gcc.dg/pr59827.c.mp2 2014-01-15 15:06:47.129210564 +0100 > +++ gcc/testsuite/gcc.dg/pr59827.c 2014-01-15 15:09:17.295843068 +0100 > @@ -0,0 +1,15 @@ > +/* PR middle-end/59827 */ > +/* { dg-do compile } */ > + > +int > +foo (int p[2][]) /* { dg-error "array type has incomplete element type" } */ > +{ > + return p[0][0]; > +} > + > +void > +bar (void) > +{ > + int p[2][1]; > + foo (p); /* { dg-error "type of formal parameter 1 is incomplete" } */ > +} > > Marek