The compiler (gcc version 4.5.0 20100312 (experimental) (GCC)) crashes when compiling the attached code with the following options: g++ -std=gnu++0x -Wno-pmf-conversions -fno-deduce-init-list -g -Wall -Werror -Wno-unused -fno-lto -msse -msse2 -mfpmath=sse -march=native -mtune=native -fomit-frame-pointer -ggdb -shared-libgcc report.cpp ------------------8<----------------------- #include <xmmintrin.h> #include <cstdint> static const __v4sf g_VecMinusTwo{ -2.0f, -2.0f, -2.0f, -2.0f }; namespace simd { template <std::uint8_t M> __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4si pshufd(__v4si a) { return __builtin_ia32_pshufd(a, M); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf addps(__v4sf a, __v4sf b) { return __builtin_ia32_addps(a, b); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf subps(__v4sf a, __v4sf b) { return __builtin_ia32_subps(a, b); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf mulps(__v4sf a, __v4sf b) { return __builtin_ia32_mulps(a, b); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf rsqrtps(__v4sf a) { return __builtin_ia32_rsqrtps(a); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf andps(__v4sf a, __v4sf b) { return __builtin_ia32_andps(a, b); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf rsqrtss(__v4sf a) { return __builtin_ia32_rsqrtss(a); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf mulss(__v4sf a, __v4sf b) { return __builtin_ia32_mulss(a, b); } template <std::uint8_t M> __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf shufps(__v4sf a, __v4sf b) { return __builtin_ia32_shufps(a, b, M); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf andnps(__v4sf a, __v4sf b) { return __builtin_ia32_andnps(a, b); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf orps(__v4sf a, __v4sf b) { return __builtin_ia32_orps(a, b); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf rcpps(__v4sf a) { return __builtin_ia32_rcpps(a); } __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf rcpss(__v4sf a) { return __builtin_ia32_rcpss(a); } template <std::uint8_t N> __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4si replicate(__v4si v) { return pshufd<(N | (N << 2) | (N << 4) | (N << 6))>(v); } template <std::uint8_t N> __attribute__((__always_inline__, __nothrow__, __const__)) inline __v4sf replicate(__v4sf v) { return (__v4sf) replicate<N>((__v4si) v); } } static __attribute__((__always_inline__)) __v4sf my_asin(__v4sf x) { static const __v4si g_Mask{ 0x7fffffff, 0x00000000, 0x7fffffff, 0x7fffffff }; __v4sf t; __v4sf u; __v4sf v; __v4sf r; u = simd::replicate<0>(x); u = simd::andps(u, (__v4sf) g_Mask); t = simd::mulps(u, __v4sf{ -1.0f, 0.0f, -0.1535779990f, 0.0f }); t = simd::addps(t, __v4sf{ 0.0f, 0.0f, 0.2836182315f, 0.0f }); t = simd::mulps(t, u); t = simd::addps(t, __v4sf{ 1.0f, 0.0f, -0.9315200116f, -2.144008022f }); r = simd::rsqrtss(t); u = simd::shufps<0b11100100>(r, u); t = simd::mulps(t, u); t = simd::addps(t, __v4sf{ 0.0f, 0.0f, -0.4089766186f, 1.103007131f }); t = simd::mulps(t, u); u = simd::mulss(u, __v4sf{ -0.5f, 0.0f, 0.0f, 0.0f }); t = simd::addps(t, __v4sf{ -3.0f, 1.0f, 1.507171600f, 1.507095111f }); t = simd::mulss(t, u); r = simd::rcpps(t); v = simd::mulps(t, r); v = simd::addps(v, g_VecMinusTwo); v = simd::mulps(v, r); t = simd::replicate<3>(t); t = simd::mulps(t, v); t = simd::replicate<2>(t); t = simd::subps(t, v); t = simd::andps((__v4sf) g_Mask, t); u = simd::andnps((__v4sf) g_Mask, x); t = simd::orps(t, u); return t; } ------------------8<----------------------- $ g++ -std=gnu++0x -Wno-pmf-conversions -fno-deduce-init-list -g -Wall -Werror -Wno-unused -fno-lto -msse -msse2 -mfpmath=sse -march=native -mtune=native -fom it-frame-pointer -ggdb -shared-libgcc report.cpp repo.cpp: In function 'float __vector[4] my_asin(float __vector[4])': repo.cpp:95:43: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Confirmed. Program received signal SIGSEGV, Segmentation fault. 0x00000000006b2ae8 in make_alias_for (target=0x7ffff599ddc0, newid=0x7ffff58d3a50) at /space/rguenther/src/svn/trunk/gcc/cp/method.c:224 224 DECL_NOT_REALLY_EXTERN (alias) = 1; (gdb) p alias $1 = (tree) 0x7ffff58d25a0 (gdb) call debug_tree (alias) <var_decl 0x7ffff58d25a0 _ZZL7my_asinDv4_fE6g_Mask type <vector_type 0x7ffff587f000 __v4si we don't have DECL_LANG_SPECIFIC for this VAR_DECL. #0 0x00000000006b2ae8 in make_alias_for (target=0x7ffff599ddc0, newid=0x7ffff58d3a50) at /space/rguenther/src/svn/trunk/gcc/cp/method.c:224 #1 0x0000000000732871 in mangle_decl (decl=0x7ffff599ddc0) at /space/rguenther/src/svn/trunk/gcc/cp/mangle.c:3081 #2 0x0000000000dff9e2 in decl_assembler_name (decl=0x7ffff599ddc0) at /space/rguenther/src/svn/trunk/gcc/tree.c:568 #3 0x0000000000e5e70a in make_decl_rtl (decl=0x7ffff599ddc0) at /space/rguenther/src/svn/trunk/gcc/varasm.c:1359 #4 0x000000000093f3a2 in expand_expr_real_1 (exp=0x7ffff599ddc0, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /space/rguenther/src/svn/trunk/gcc/expr.c:8442 #5 0x000000000093856b in expand_expr_real (exp=0x7ffff599ddc0, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /space/rguenther/src/svn/trunk/gcc/expr.c:7191 #6 0x00000000009244fe in expand_expr (exp=0x7ffff599ddc0, target=0x0, mode=VOIDmode, modifier=EXPAND_NORMAL) at /space/rguenther/src/svn/trunk/gcc/expr.h:558 Caused by the vector mangling ABI stuff I guess.
(In reply to comment #1) It's a fairly recent regression: the snapshot 20100218 compiled it without problems.
It is caused by revision 157203: http://gcc.gnu.org/ml/gcc-cvs/2010-03/msg00075.html
A small tectcase; -- typedef float __v4sf __attribute__ ((__vector_size__ (16))); typedef int __v4si __attribute__ ((__vector_size__ (16))); __v4sf my_asin(__v4sf x) { static const __v4si g_Mask{ 0x7fffffff, 0x00000000, 0x7fffffff, 0x7fffffff }; return __builtin_ia32_andnps ((__v4sf) g_Mask, x); } --
A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00669.html
Subject: Bug 43375 Author: dodji Date: Sat Mar 20 08:55:32 2010 New Revision: 157590 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157590 Log: Fix for PR c++/43375 gcc/cp/ChangeLog: PR c++/43375 * method.c (make_alias_for): Avoid crashing when DECL_LANG_SPECIFIC is NULL. * decl2.c (vague_linkage_p): Likewise. gcc/testsuite/g++.dg/ChangeLog: PR c++/43375 * g++.dg/abi/mangle42.C: New test. Added: trunk/gcc/testsuite/g++.dg/abi/mangle42.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl2.c trunk/gcc/cp/method.c trunk/gcc/testsuite/ChangeLog
Fixed in 4.5
(In reply to comment #7) > Fixed in 4.5 But not marked as FIXED. I did so now, I hope that's OK.
Subject: Bug 43375 Author: hjl Date: Thu Mar 25 16:39:51 2010 New Revision: 157726 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157726 Log: Backport regression testcases from mainline. 2010-03-25 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2010-03-22 Jason Merrill <jason@redhat.com> PR c++/43333 * g++.dg/ext/is_pod_98.C: New. 2010-03-22 Michael Matz <matz@suse.de> PR middle-end/43475 * gfortran.dg/pr43475.f90: New testcase. 2010-03-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/43390 * gfortran.fortran-torture/execute/pr43390.f90: New testcase. 2010-03-20 Dodji Seketeli <dodji@redhat.com> PR c++/43375 * g++.dg/abi/mangle42.C: New test. 2010-03-19 Andrew Pinski <andrew_pinski@caviumnetworks.com> PR C/43211 * gcc.dg/pr43211.c: New test. 2010-03-18 Martin Jambor <mjambor@suse.cz> PR middle-end/42450 * g++.dg/torture/pr42450.C: New test. 2010-03-18 Michael Matz <matz@suse.de> PR tree-optimization/43402 * gcc.dg/pr43402.c: New testcase. 2010-03-17 Peter Bergner <bergner@vnet.ibm.com> PR target/42427 * gcc.dg/pr42427.c: New test. 2010-03-16 Richard Guenther <rguenther@suse.de> PR middle-end/43379 * gcc.dg/pr43379.c: New testcase. 2010-03-15 Michael Matz <matz@suse.de> PR middle-end/43300 * gcc.dg/pr43300.c: New testcase. 2010-03-15 Richard Guenther <rguenther@suse.de> PR tree-optimization/43367 * gcc.c-torture/compile/pr43367.c: New testcase. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/abi/mangle42.C - copied unchanged from r157725, trunk/gcc/testsuite/g++.dg/abi/mangle42.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/is_pod_98.C - copied unchanged from r157725, trunk/gcc/testsuite/g++.dg/ext/is_pod_98.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42450.C - copied unchanged from r157725, trunk/gcc/testsuite/g++.dg/torture/pr42450.C branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr43367.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.c-torture/compile/pr43367.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42427.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr42427.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43211.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43211.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43300.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43300.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43379.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43379.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43402.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43402.c branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr43475.f90 - copied unchanged from r157725, trunk/gcc/testsuite/gfortran.dg/pr43475.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.fortran-torture/execute/pr43390.f90 - copied unchanged from r157725, trunk/gcc/testsuite/gfortran.fortran-torture/execute/pr43390.f90 Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog