ICE with imaginary component in mangled expression. ## Small self-contained source (cmplxfMangle.cpp): template <unsigned N> struct A; template <typename U, typename V> char foo(U, V); template <typename U> void bar(A<sizeof(foo(U(), 1.0fj))> *); int main() { bar<int>(0); } ## Compiler invocation: g++-4.6.0 cmplxfMangle.cpp -c ## Compiler output: cmplxfMangle.cpp: In instantiation of âvoid bar(A<sizeof (char foo(U(), (__complex__ float){0.0f, 1.0e+0f}))>*) [with U = int]â: cmplxfMangle.cpp:10:15: instantiated from here cmplxfMangle.cpp:7:6: internal compiler error: in write_template_arg_literal, at cp/mangle.c:2772 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. ## g++ -v output: Using built-in specs. COLLECT_GCC=g++-4.6.0 COLLECT_LTO_WRAPPER=/data/gcc/libexec/gcc/powerpc64-unknown-linux-gnu/4.6.0/lto-wrapper Target: powerpc64-unknown-linux-gnu Configured with: ./configure --prefix=/data/gcc --program-suffix=-4.6.0 --disable-libssp --disable-libgcj --enable-version-specific-runtime-libs --with-cpu=default32 --enable-secureplt --with-long-double-128 --enable-shared --enable-__cxa_atexit --enable-threads=posix --enable-languages=c,c++,fortran --with-gmp=/usr/local Thread model: posix gcc version 4.6.0 (GCC)
4.3 gave the following sorry: t.cc:11: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI Confirmed.
I wonder whether: --- gcc/cp/mangle.c.jj 2012-01-13 21:47:31.000000000 +0100 +++ gcc/cp/mangle.c 2012-01-16 19:26:48.474088778 +0100 @@ -2927,6 +2927,25 @@ write_template_arg_literal (const tree v write_real_cst (value); break; + case COMPLEX_CST: + if (TREE_CODE (TREE_REALPART (value)) == INTEGER_CST + && TREE_CODE (TREE_IMAGPART (value)) == INTEGER_CST) + { + write_integer_cst (TREE_REALPART (value)); + write_char ('_'); + write_integer_cst (TREE_IMAGPART (value)); + } + else if (TREE_CODE (TREE_REALPART (value)) == REAL_CST + && TREE_CODE (TREE_IMAGPART (value)) == REAL_CST) + { + write_real_cst (TREE_REALPART (value)); + write_char ('_'); + write_real_cst (TREE_IMAGPART (value)); + } + else + gcc_unreachable (); + break; + case STRING_CST: sorry ("string literal in function template signature"); break; isn't the right fix for this (of course, missing testcases etc.).
Author: jason Date: Mon Jan 16 21:32:14 2012 New Revision: 183222 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183222 Log: PR c++/51854 * mangle.c (write_template_arg_literal): Handle complex. Added: trunk/gcc/testsuite/g++.dg/abi/mangle60.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/mangle.c trunk/gcc/testsuite/ChangeLog
Author: jason Date: Mon Jan 16 21:49:58 2012 New Revision: 183224 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183224 Log: PR c++/51854 * mangle.c (write_template_arg_literal): Sorry instead of aborting. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/abi/mangle60.C Modified: branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/mangle.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
ICE fixed for 4.6.3; mangling fixed for 4.7.0. I don't think this is worth fixing in 4.4/4.5.