Bang uptodate Debian testing/unstable g++-3.2 ICEs on this code. Interestingly, it's already started generating the .s file. # 1 "playpen.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "playpen.cpp" template <typename A1> void monk2 (A1) {} unsigned int strlen (const char*); void monk () { monk2 (strlen ("")); } + g++-3.2 -v -g -W -Wall -pedantic -c playpen.cpp -o playpen.o --save-temps Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.1/specs Configured with: /mnt/data/gcc-3.1/gcc-3.2-3.2.1ds3/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-java-gc=boehm --enable-objc-gc i386-linux Thread model: posix gcc version 3.2.1 20021020 (Debian prerelease) /usr/lib/gcc-lib/i386-linux/3.2.1/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ playpen.cpp -W -Wall -pedantic playpen.ii GNU CPP version 3.2.1 20021020 (Debian prerelease) (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "/usr/i386-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/3.2 /usr/include/c++/3.2/i386-linux /usr/include/c++/3.2/backward /usr/local/include /usr/lib/gcc-lib/i386-linux/3.2.1/include /usr/include End of search list. /usr/lib/gcc-lib/i386-linux/3.2.1/cc1plus -fpreprocessed playpen.ii -quiet -dumpbase playpen.cpp -g -W -Wall -pedantic -version -o playpen.s GNU CPP version 3.2.1 20021020 (Debian prerelease) (cpplib) (i386 Linux/ELF) GNU C++ version 3.2.1 20021020 (Debian prerelease) (i386-linux) compiled by GNU C version 3.2.1 20021020 (Debian prerelease). playpen.cpp: In function `void monk()': playpen.cpp:10: internal error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions. .file "playpen.cpp" .file 1 "playpen.cpp" .section .debug_abbrev,"",@progbits .Ldebug_abbrev0: .section .debug_info,"",@progbits .Ldebug_info0: .section .debug_line,"",@progbits .Ldebug_line0: .text .Ltext0: Release: gcc-3.2.1 20021020 (Debian prerelease), mainline Environment: Linux trevithick 2.4.16 #2 Mon Dec 10 15:54:50 GMT 2001 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz GenuineIntel GNU/Linux
Fix: http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00019.html
From: Andrew Pinski <pinskia@physics.uc.edu> To: martin.dorey@bluearc.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/8332: strlen/template interaction causes ICE Date: Wed, 23 Oct 2002 22:05:18 -0700 This works fine for me on gcc 3.3 i686-pc-linux-gnu. It also works on gcc 3.1.1, so it looks like a Debian specific bug, report it to them. Thanks, Andrew Pinski
State-Changed-From-To: open->analyzed State-Changed-Why: I _can_ reproduce this. The bug goes away, if strlen is renamed, or if its return type is changed to "int", so I assume this has something to do with built-ins. However, since the code also SegFaults if we include <string.h>, I have no reason to believe that this code is wrong. I'd think this is a serious regression from previous releases! For more information: the SegFault occurs here: #0 write_builtin_type (type=0x0) at ../../gcc-3.2/gcc/cp/mangle.c:1569 #1 0x080bbfc5 in write_type (type=0x401888c0) at ../../gcc-3.2/gcc/cp/mangle.c:1399 #2 0x080bc8df in write_template_args (args=0x4019ec80) at ../../gcc-3.2/gcc/cp/mangle.c:1789 #3 0x080bb13f in write_name (decl=0x401aac40, ignore_local_scope=0) at ../../gcc-3.2/gcc/cp/mangle.c:719 #4 0x080bafd3 in write_encoding (decl=0x401aac40) at ../../gcc-3.2/gcc/cp/mangle.c:654 #5 0x080bd586 in mangle_decl_string (decl=0x401aac40) at ../../gcc-3.2/gcc/cp/mangle.c:630 The code in question is /* TYPE may still be wchar_t, since that isn't in integer_type_nodes. */ if (type == wchar_type_node) write_char ('w'); else if (TYPE_FOR_JAVA (type)) <<<<< here write_java_integer_type_codes (type); else and the reason is that type==0. On one frame higher, this code is called from write_builtin_type (TYPE_MAIN_VARIANT (type)); Here, type is still!=0, but given the nesting of macros, this is the point where I leave the rest to someone else. Regards Wolfgang
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu> To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/8332: strlen/template interaction causes ICE Date: Thu, 7 Nov 2002 17:20:51 -0600 (CST) This one may be related to PR 8493. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth
Responsible-Changed-From-To: unassigned->mmitchel Responsible-Changed-Why: Working on a fix.
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed in GCC 3.2.2/GCC 3.3.
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/8332 Date: 1 Dec 2002 17:51:51 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2002-12-01 09:51:51 Modified files: gcc : ChangeLog builtin-types.def builtins.c c-common.c c-common.h c-format.c tree.h gcc/cp : ChangeLog decl.c decl2.c except.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: strlen1.C Log message: PR c++/8332 PR c++/8493 * decl.c (cxx_init_decl_processing): Use size_type_node, not c_size_type_node. * decl2.c (coerce_new_type): Likewise. * except.c (do_allocate_exception): Likewise. * builtin-types.def (BT_SIZE): Use size_type_node. * builtins.c (fold_builtin): Make the builtin strlen returns a size_t, not a sizetype. * c-common.c (c_sizeof_or_alignof_type): Use size_type_node, not c_size_type_node. (c_alignof_expr): Likewise. (c_common_nodes_and_builtins): Likewise. * c-common.h (CTI_C_SIZE_TYPE): Remove. (c_size_type_node): Likewise. * c-format.c (T_ST): Use size_type_node, not c_size_type_node. * tree.h (TI_SIZE_TYPE): New enumeral. (size_type_node): Likewise. PR c++/8332 PR c++/8493 * g++.dg/template/strlen1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.16031&r2=1.16032 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtin-types.def.diff?cvsroot=gcc&r1=1.9&r2=1.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.164&r2=1.165 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.391&r2=1.392 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.163&r2=1.164 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-format.c.diff?cvsroot=gcc&r1=1.29&r2=1.30 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.364&r2=1.365 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3060&r2=1.3061 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.961&r2=1.962 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.573&r2=1.574 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/except.c.diff?cvsroot=gcc&r1=1.147&r2=1.148 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2242&r2=1.2243 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/strlen1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/8332 Date: 1 Dec 2002 18:19:15 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_2-branch Changes by: mmitchel@gcc.gnu.org 2002-12-01 10:19:15 Modified files: gcc : ChangeLog builtin-types.def builtins.c c-common.c c-common.h c-format.c c-typeck.c tree.h gcc/cp : ChangeLog decl.c decl2.c except.c typeck.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: strlen1.C Log message: PR c++/8332 PR c++/8493 * decl.c (cxx_init_decl_processing): Use size_type_node, not c_size_type_node. * decl2.c (coerce_new_type): Likewise. * except.c (do_allocate_exception): Likewise. * typeck.c (c_sizeof): Likewise. (c_sizeof_nowarn): Likewise. * builtin-types.def (BT_SIZE): Use size_type_node. * builtins.c (fold_builtin): Make the builtin strlen returns a size_t, not a sizetype. * c-common.c (c_alignof): Use size_type_node, not c_size_type_node. (c_alignof_expr): Likewise. (c_common_nodes_and_builtins): Likewise. * c-common.h (CTI_C_SIZE_TYPE): Remove. (c_size_type_node): Likewise. * c-format.c (T_ST): Use size_type_node, not c_size_type_node. * tree.h (TI_SIZE_TYPE): New enumeral. (size_type_node): Likewise. PR c++/8332 PR c++/8493 * g++.dg/template/strlen1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.152&r2=1.13152.2.657.2.153 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtin-types.def.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.5&r2=1.5.6.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.142.2.2&r2=1.142.2.2.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.294.2.9.2.2&r2=1.294.2.9.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.115.2.3.4.1&r2=1.115.2.3.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-format.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.17&r2=1.17.6.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.180.2.2.4.2&r2=1.180.2.2.4.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.308.2.2.4.2&r2=1.308.2.2.4.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.45&r2=1.2685.2.114.2.46 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.866.2.36.2.12&r2=1.866.2.36.2.13 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.520.2.7.2.8&r2=1.520.2.7.2.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/except.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.140&r2=1.140.12.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.388.2.10.2.3&r2=1.388.2.10.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.60&r2=1.1672.2.166.2.61 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/strlen1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1