public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH to fix ICE-on-invalid with -Wabi (PR c++/83490)
@ 2017-12-19 14:50 Marek Polacek
  2017-12-19 14:55 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2017-12-19 14:50 UTC (permalink / raw)
  To: GCC Patches

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  <polacek@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH to fix ICE-on-invalid with -Wabi (PR c++/83490)
  2017-12-19 14:50 PATCH to fix ICE-on-invalid with -Wabi (PR c++/83490) Marek Polacek
@ 2017-12-19 14:55 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2017-12-19 14:55 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches

On Tue, Dec 19, 2017 at 03:50:33PM +0100, Marek Polacek wrote:
> 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  <polacek@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.

Ok, thanks.

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-19 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 14:50 PATCH to fix ICE-on-invalid with -Wabi (PR c++/83490) Marek Polacek
2017-12-19 14:55 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).