From cc3dac976e2b61fcf3c0236255a6dcc99e3bafe8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 3 Jan 2019 11:11:40 +0100 Subject: [PATCH] re PR c++/88636 (ICE: Segmentation fault (in c_tree_chain_next)) 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. From-SVN: r267548 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 6 ++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.target/i386/pr88636.C | 6 ++++++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/pr88636.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b94654b10a..32576c58b84 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-01-03 Jakub Jelinek + + PR c++/88636 + * decl.c (builtin_function_1): Return result of pushdecl_top_level + or pushdecl rather than decl. + 2019-01-03 Paolo Carlini * tree.c (handle_nodiscard_attribute): Improve warning location. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2003008afc0..15bc4887a59 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4536,11 +4536,9 @@ builtin_function_1 (tree decl, tree context, bool is_global) } if (is_global) - pushdecl_top_level (decl); + return pushdecl_top_level (decl); else - pushdecl (decl); - - return decl; + return pushdecl (decl); } tree diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c077f7a9a8e..413bb098b7c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-03 Jakub Jelinek + + PR c++/88636 + * g++.target/i386/pr88636.C: New test. + 2019-01-03 Paolo Carlini * g++.dg/cpp1z/nodiscard3.C: Test locations too. diff --git a/gcc/testsuite/g++.target/i386/pr88636.C b/gcc/testsuite/g++.target/i386/pr88636.C new file mode 100644 index 00000000000..fa4c1327bd5 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr88636.C @@ -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") -- 2.30.2