[Bug c++/69510] New: segfault in write_template_prefix while compiling C++ template code
vapier at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 27 06:30:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69510
Bug ID: 69510
Summary: segfault in write_template_prefix while compiling C++
template code
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vapier at gcc dot gnu.org
Target Milestone: ---
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Created attachment 37485
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37485&action=edit
test.ii reduced testcase
the attached test case (by Philippe Marti) crashes g++ starting with 4.9 (and
including 5.3). 4.8 and older work.
$ g++ -c test.ii -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/5.3.0/g++
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/5.3.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.3.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.3.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.3.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/5.3.0/python
--enable-languages=c,c++,java,go,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 5.3.0 p1.0, pie-0.6.5' --enable-libstdcxx-time
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-multilib --with-multilib-list=mx32,m32,m64
--disable-altivec --disable-fixed-point --with-abi=m64 --enable-targets=all
--enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts
--enable-lto --with-isl --disable-isl-version-check --enable-libsanitizer
Thread model: posix
gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5)
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'test.o' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
/usr/libexec/gcc/x86_64-pc-linux-gnu/5.3.0/cc1plus -fpreprocessed test.ii
-quiet -dumpbase test.ii -mtune=generic -march=x86-64 -auxbase-strip test.o
-version -fstack-protector-strong -o /tmp/ccxZdwTF.s
GNU C++ (Gentoo 5.3.0 p1.0, pie-0.6.5) version 5.3.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 5.3.0, GMP version 6.1.0, MPFR version
3.1.3-p4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Gentoo 5.3.0 p1.0, pie-0.6.5) version 5.3.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 5.3.0, GMP version 6.1.0, MPFR version
3.1.3-p4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 542af32c761d4d0725ea4eab192ccd39
test.ii: In instantiation of 'void Test<TID>::func(typename TClass<TID>::Type)
[with TClass = A; int TID = 1; typename TClass<TID>::Type = double]':
test.ii:2:54: internal compiler error: Segmentation fault
public: template <template <int> class TClass> void func(typename
TClass<TID>::Type x) {};
^
Please submit a full bug report,
with preprocessed source if appropriate.
here's the gdb output:
$ gdb --args g++ test.ii
Reading symbols from /usr/bin/g++...(no debugging symbols found)...done.
(gdb) set follow-fork-mode child
(gdb) r
Starting program: /usr/bin/g++ test.ii
process 4832 is executing new program:
/usr/x86_64-pc-linux-gnu/gcc-bin/5.3.0/x86_64-pc-linux-gnu-g++
[New process 4836]
process 4836 is executing new program:
/usr/libexec/gcc/x86_64-pc-linux-gnu/5.3.0/cc1plus
Program received signal SIGSEGV, Segmentation fault.
[Switching to process 4836]
write_template_prefix (node=node@entry=0x7ffff65a6be0) at
.../gcc-5.3.0/gcc/cp/mangle.c:1163
1163 .../gcc-5.3.0/gcc/cp/mangle.c: No such file or directory.
(gdb) bt
#0 write_template_prefix (node=node@entry=0x7ffff65a6be0) at
.../gcc-5.3.0/gcc/cp/mangle.c:1163
#1 0x00000000006e6f0c in write_prefix (node=0x7ffff65acb28) at
.../gcc-5.3.0/gcc/cp/mangle.c:1078
#2 0x00000000006e7171 in write_nested_name (decl=0x7ffff65a6c78) at
.../gcc-5.3.0/gcc/cp/mangle.c:1009
#3 0x00000000006e37c9 in write_type (type=0x7ffff65acbd0) at
.../gcc-5.3.0/gcc/cp/mangle.c:2017
#4 0x00000000006e5c72 in write_method_parms (parm_types=0x7ffff65a3a00,
method_p=<optimized out>, decl=<optimized out>) at
.../gcc-5.3.0/gcc/cp/mangle.c:2540
#5 0x00000000006e5d8d in write_bare_function_type (type=0x7ffff65acd20,
include_return_type_p=0x1, decl=<optimized out>) at
.../gcc-5.3.0/gcc/cp/mangle.c:2482
#6 0x00000000006e8acc in mangle_decl_string (decl=decl@entry=0x7ffff65ad510)
at .../gcc-5.3.0/gcc/cp/mangle.c:3449
#7 0x00000000006e8c37 in get_mangled_id (decl=0x7ffff65ad510) at
.../gcc-5.3.0/gcc/cp/mangle.c:3471
#8 mangle_decl (decl=0x7ffff65ad510) at .../gcc-5.3.0/gcc/cp/mangle.c:3527
#9 0x0000000000cac229 in decl_assembler_name (decl=0x7ffff65ad510) at
.../gcc-5.3.0/gcc/tree.c:697
#10 0x00000000007c3ef5 in symtab_node::get_comdat_group_id
(this=0x7ffff64497a8) at .../gcc-5.3.0/gcc/cgraph.h:207
#11 analyze_functions () at .../gcc-5.3.0/gcc/cgraphunit.c:973
#12 0x00000000007c4c26 in symbol_table::finalize_compilation_unit
(this=0x7ffff643c000) at .../gcc-5.3.0/gcc/cgraphunit.c:2452
#13 0x0000000000659383 in cp_write_global_declarations () at
.../gcc-5.3.0/gcc/cp/decl2.c:4840
#14 0x0000000000acd7a5 in compile_file () at .../gcc-5.3.0/gcc/toplev.c:613
#15 0x00000000005e7af0 in do_compile () at .../gcc-5.3.0/gcc/toplev.c:2067
#16 toplev::main (this=this@entry=0x7fffffffca00, argc=argc@entry=0xd,
argv=argv@entry=0x7fffffffcb08) at .../gcc-5.3.0/gcc/toplev.c:2165
#17 0x00000000005e885e in main (argc=0xd, argv=0x7fffffffcb08) at
.../gcc-5.3.0/gcc/main.c:39
More information about the Gcc-bugs
mailing list