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  <ja...@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

Reply via email to