Hi!

On the following testcase we ICE, because we end up with a CALL_EXPR
with error_mark_node argument and gimplification can't cope with that.

Normally, if one or more arguments are error_mark_node we return -1
and drop the whole call, but if we also report too many arguments,
we failed to do so.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2015-01-26  Jakub Jelinek  <ja...@redhat.com>

        PR c/64778
        * c-typeck.c (convert_arguments): Return -1 if there are
        error_args, even if we've diagnosed too many arguments.

        * gcc.dg/pr64778.c: New test.

--- gcc/c/c-typeck.c.jj 2015-01-15 23:39:03.000000000 +0100
+++ gcc/c/c-typeck.c    2015-01-26 12:09:57.151820878 +0100
@@ -3143,7 +3143,7 @@ convert_arguments (location_t loc, vec<l
          else
            error_at (loc, "too many arguments to function %qE", function);
          inform_declaration (fundecl);
-         return parmnum;
+         return error_args ? -1 : (int) parmnum;
        }
 
       if (selector && argnum > 2)
--- gcc/testsuite/gcc.dg/pr64778.c.jj   2015-01-26 12:18:12.216366230 +0100
+++ gcc/testsuite/gcc.dg/pr64778.c      2015-01-26 12:17:58.000000000 +0100
@@ -0,0 +1,10 @@
+/* PR c/64778 */
+/* { dg-do compile } */
+
+int
+foo (int p)
+{
+  int a;
+  a ^= foo (,);        /* { dg-error "expected expression before|too many 
arguments" } */
+  return a;
+}

        Jakub

Reply via email to