diff mbox series

[C++] Fix ICEs with builtin redeclaration (PR c++/88636)

Message ID 20190102100919.GH30353@tucnak
State New
Headers show
Series [C++] Fix ICEs with builtin redeclaration (PR c++/88636) | expand

Commit Message

Jakub Jelinek Jan. 2, 2019, 10:09 a.m. UTC
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.


	Jakub

Comments

Jason Merrill Jan. 2, 2019, 9:31 p.m. UTC | #1
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.
diff mbox series

Patch

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