public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Fix ICEs with builtin redeclaration (PR c++/88636)
@ 2019-01-02 10:09 Jakub Jelinek
  2019-01-02 21:31 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2019-01-02 10:09 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

On the following testcase we ICE, because pushdecl* ggc_frees the decl
passed to it, but builtin_function_1 returns it anyway.

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

2019-01-02  Jakub Jelinek  <jakub@redhat.com>

	PR c++/88636
	* decl.c (builtin_function_1): Return result of pushdecl_top_level
	or pushdecl rather than decl.

	* g++.target/i386/pr88636.C: New test.

--- gcc/cp/decl.c.jj	2018-12-20 08:50:29.682444440 +0100
+++ gcc/cp/decl.c	2018-12-30 22:28:36.012759687 +0100
@@ -4536,11 +4536,9 @@ builtin_function_1 (tree decl, tree cont
     }
 
   if (is_global)
-    pushdecl_top_level (decl);
+    return pushdecl_top_level (decl);
   else
-    pushdecl (decl);
-
-  return decl;
+    return pushdecl (decl);
 }
 
 tree
--- gcc/testsuite/g++.target/i386/pr88636.C.jj	2018-12-31 10:11:18.224723703 +0100
+++ gcc/testsuite/g++.target/i386/pr88636.C	2018-12-31 10:10:58.253050173 +0100
@@ -0,0 +1,6 @@
+// PR c++/88636
+// { dg-do compile }
+// { dg-options "-msse2 -mno-sse3 -fno-exceptions --param ggc-min-heapsize=0" }
+
+extern unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int);
+#pragma GCC target("sse4.2")

	Jakub

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

* Re: [C++ PATCH] Fix ICEs with builtin redeclaration (PR c++/88636)
  2019-01-02 10:09 [C++ PATCH] Fix ICEs with builtin redeclaration (PR c++/88636) Jakub Jelinek
@ 2019-01-02 21:31 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2019-01-02 21:31 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 1/2/19 5:09 AM, Jakub Jelinek wrote:
> Hi!
> 
> On the following testcase we ICE, because pushdecl* ggc_frees the decl
> passed to it, but builtin_function_1 returns it anyway.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

OK.

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

end of thread, other threads:[~2019-01-02 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-02 10:09 [C++ PATCH] Fix ICEs with builtin redeclaration (PR c++/88636) Jakub Jelinek
2019-01-02 21:31 ` Jason Merrill

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).