http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50102

             Bug #: 50102
           Summary: ICE in cp/mangle.c:write_type()
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: pthau...@gcc.gnu.org
              Host: powerpc64-linux
            Target: powerpc64-linux
             Build: powerpc64-linux


Appears this started back in 4.5, still appears in trunk. Testcase is reduced,
original source did not have extra errors.

> cat test.cpp 
namespace std {
namespace decimal {

template <uint32_t _Digits, uint32_t _Scale>
class _FmtTraits<_PackedDecimal<_Digits, _Scale> > {
};

template <class _Tr>
class _DecBase {
};

class decimal32 : public _DecBase<_FmtTraits<decimal32> > {
};

inline long double decimal32_to_long_double(decimal32 _D)
        { return _DecNumber(_D)._ToLongDouble(); }

}
}

> ~/install/gcc/trunk_debug/bin/g++ -c test.cpp 
test.cpp:4:11: error: ‘uint32_t’ has not been declared
test.cpp:4:29: error: ‘uint32_t’ has not been declared
test.cpp:5:7: error: ‘_FmtTraits’ is not a template
test.cpp:5:18: error: ‘_PackedDecimal’ was not declared in this scope
test.cpp:5:50: error: expected unqualified-id before ‘>’ token
test.cpp:12:35: error: ‘std::decimal::_FmtTraits’ is not a template
test.cpp: In function ‘long double
std::decimal::decimal32_to_long_double(std::decimal::decimal32)’:
test.cpp:16:31: error: ‘_DecNumber’ was not declared in this scope
test.cpp: At global scope:
test.cpp:15:20: 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.


From gdb:

Program received signal SIGSEGV, Segmentation fault.
0x000000001049f348 in write_type (type=0xfffb6dfc828)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:1797
1797        type = TREE_TYPE (first_field (type));
(gdb) call debug_tree(type)
 <record_type 0xfffb6dfc828 decimal32 transparent-aggr type_5 QI
    size <integer_cst 0xfffb6c527a0 type <integer_type 0xfffb6d500a8
bitsizetype> constant 8>
    unit size <integer_cst 0xfffb6c527c0 type <integer_type 0xfffb6d50000
sizetype> constant 1>
    align 8 symtab 0 alias set -1 canonical type 0xfffb6dfc828
    fields <type_decl 0xfffb6cf4a08 decimal32
        type <record_type 0xfffb6dfcac8 decimal32 transparent-aggr type_5 QI
size <integer_cst 0xfffb6c527a0 8> unit size <integer_cst 0xfffb6c527c0 1>
            align 8 symtab 0 alias set -1 canonical type 0xfffb6dfc828 fields
<type_decl 0xfffb6cf4a08 decimal32> context <namespace_decl 0xfffb6cf4220
decimal>
            full-name "class std::decimal::decimal32"
            X() X(constX&) this=(X&) n_parents=1 use_template=0
interface-unknown
            chain <type_decl 0xfffb6cf4728 decimal32>>
        nonlocal decl_4 VOID file test.cpp line 12 col 59
        align 1 context <record_type 0xfffb6dfc828 decimal32> result
<record_type 0xfffb6dfc828 decimal32>
       > context <namespace_decl 0xfffb6cf4220 decimal>
    full-name "class std::decimal::decimal32"
    X() X(constX&) this=(X&) n_parents=1 use_template=0 interface-unknown
    chain <type_decl 0xfffb6cf4728 decimal32>>
(gdb) bt 10
#0  0x000000001049f348 in write_type (type=0xfffb6dfc828)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:1797
#1  0x00000000104a34e0 in write_method_parms (parm_types=0xfffb6e42fa8,
method_p=0, 
    decl=0xfffb6e35f00) at
/home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:2373
#2  0x00000000104a3008 in write_bare_function_type (type=0xfffb6dfcc18, 
    include_return_type_p=0, decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:2313
#3  0x0000000010494ecc in write_encoding (decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:735
#4  0x0000000010493a28 in write_mangled_name (decl=0xfffb6e35f00, top_level=1
'\001')
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:684
#5  0x00000000104a9c90 in mangle_decl_string (decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:3124
#6  0x00000000104a9f30 in mangle_decl (decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/mangle.c:3146
#7  0x0000000010fc7a44 in decl_assembler_name (decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/tree.c:538
#8  0x00000000101c71bc in cxx_comdat_group (decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/decl.c:13770
#9  0x00000000102e991c in comdat_linkage (decl=0xfffb6e35f00)
    at /home/pthaugen/src/gcc/trunk_debug/gcc/gcc/cp/decl2.c:1591

> ~/install/gcc/trunk_debug/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/pthaugen/install/gcc/trunk_debug/bin/g++
COLLECT_LTO_WRAPPER=/home/pthaugen/install/gcc/trunk_debug/libexec/gcc/powerpc64-linux/4.7.0/lto-wrapper
Target: powerpc64-linux
Configured with: /home/pthaugen/src/gcc/trunk_debug/gcc/configure
--prefix=/home/pthaugen/install/gcc/trunk_debug --target=powerpc64-linux
--host=powerpc64-linux --build=powerpc64-linux --enable-secureplt
--enable-threads=posix --enable-shared --enable-__cxa_atexit
--with-long-double-128 --enable-decimal-float --disable-alsa --enable-checking
--with-lto --with-as=/home/wschmidt/binutils/install/bin/as
--with-ld=/home/wschmidt/binutils/install/bin/ld
--with-libelf=/home/pthaugen/install/gcc-host-libs
--with-gmp=/home/pthaugen/install/gcc-host-libs
--with-mpfr=/home/pthaugen/install/gcc-host-libs
--with-mpc=/home/pthaugen/install/gcc-host-libs
--with-ppl=/home/pthaugen/install/gcc-host-libs
--with-cloog=/home/pthaugen/install/gcc-host-libs
--with-host-libstdcxx='-L/home/pthaugen/install/gcc-host-libs/lib -lstdc++ -lm'
--enable-languages=c,fortran,c++ --disable-bootstrap
Thread model: posix
gcc version 4.7.0 20110709 (experimental) (GCC)

Reply via email to