This is an ICE-on-invalid where the code in init_cumulative_args tries to
determine if it should warn about the empty classes ABI change, but is upset
when it encounters error_mark_node.  Thus fixed.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2017-12-19  Marek Polacek  <pola...@redhat.com>

        PR c++/83490
        * config/i386/i386.c (init_cumulative_args): Don't check TYPE_EMPTY_P
        on an error node.                                                    

        * g++.dg/abi/pr83490.C: New test.

diff --git gcc/config/i386/i386.c gcc/config/i386/i386.c
index b9f6e27f9b1..82a79bdb426 100644
--- gcc/config/i386/i386.c
+++ gcc/config/i386/i386.c
@@ -7218,7 +7218,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum,  /* Argument 
info to initialize */
       bool seen_empty_type = false;
       FOREACH_FUNCTION_ARGS (fntype, argtype, iter)
        {
-         if (VOID_TYPE_P (argtype))
+         if (argtype == error_mark_node || VOID_TYPE_P (argtype))
            break;
          if (TYPE_EMPTY_P (argtype))
            seen_empty_type = true;
diff --git gcc/testsuite/g++.dg/abi/pr83490.C gcc/testsuite/g++.dg/abi/pr83490.C
index e69de29bb2d..850c4c0fd9e 100644
--- gcc/testsuite/g++.dg/abi/pr83490.C
+++ gcc/testsuite/g++.dg/abi/pr83490.C
@@ -0,0 +1,17 @@
+// PR c++/83490
+// { dg-options "-Wabi" }
+
+struct A
+{
+  A foo(void i = 0);  // { dg-error "incomplete type|invalid use" }
+};
+
+void bar()
+{
+  A().foo();
+}
+
+A A::foo(void i)  // { dg-error "incomplete type|invalid use" }
+{
+  return A();
+}

        Marek

Reply via email to