From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19973 invoked by alias); 26 Oct 2008 17:37:05 -0000 Received: (qmail 19761 invoked by uid 48); 26 Oct 2008 17:35:41 -0000 Date: Sun, 26 Oct 2008 17:37:00 -0000 Subject: [Bug c++/37920] New: ICE (segv) with typename typeof X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gcc at keithr dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-10/txt/msg01667.txt.bz2 When compiling the attached code, I get an ICE: $ /usr/lib/gcc-snapshot/bin/g++ -v -Q -save-temps -c ice.cpp Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 20080404-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,c++,java,fortran,objc,obj-c++,ada --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo --disable-plugin --with-java-home=/usr/lib/gcc-snapshot/jre --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-mpfr --enable-targets=all --disable-werror --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.3.1 20080404 (prerelease) [gcc-4_3-branch revision 133917] (Ubuntu 20080404-0ubuntu1) COLLECT_GCC_OPTIONS='-v' '-Q' '-save-temps' '-c' '-shared-libgcc' '-mtune=generic' /usr/lib/gcc-snapshot/libexec/gcc/i486-linux-gnu/4.3.1/cc1plus -E -v -D_GNU_SOURCE ice.cpp -mtune=generic -fpch-preprocess -o ice.ii ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.3.1/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.3.1/../../../../include/c++/4.3.1 /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.3.1/../../../../include/c++/4.3.1/i486-linux-gnu /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward /usr/local/include /usr/lib/gcc-snapshot/include /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.3.1/include /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.3.1/include-fixed /usr/include End of search list. Execution times (seconds) TOTAL : 0.17 0.02 0.20 3835 kB COLLECT_GCC_OPTIONS='-v' '-Q' '-save-temps' '-c' '-shared-libgcc' '-mtune=generic' /usr/lib/gcc-snapshot/libexec/gcc/i486-linux-gnu/4.3.1/cc1plus -fpreprocessed ice.ii -dumpbase ice.cpp -mtune=generic -auxbase ice -version -o ice.s GNU C++ (Ubuntu 20080404-0ubuntu1) version 4.3.1 20080404 (prerelease) [gcc-4_3-branch revision 133917] (i486-linux-gnu) compiled by GNU C version 4.3.1 20080404 (prerelease) [gcc-4_3-branch revision 133917], GMP version 4.2.2, MPFR version 2.3.1. GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128223 options passed: -fpreprocessed ice.ii -mtune=generic options enabled: -falign-loops -fargument-alias -fauto-inc-dec -fbranch-count-reg -fcommon -fearly-inlining -feliminate-unused-debug-types -fexceptions -ffunction-cse -fgcse-lm -fident -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno -fmerge-debug-strings -fmove-loop-invariants -fpcc-struct-return -fpeephole -fsched-interblock -fsched-spec -fsched-stalled-insns-dep -fsigned-zeros -fsplit-ivs-in-unroller -ftoplevel-reorder -ftrapping-math -ftree-cselim -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops= -ftree-reassoc -ftree-scev-cprop -ftree-vect-loop-version -fvar-tracking -fvect-cost-model -fzero-initialized-in-bss -m32 -m80387 -m96bit-long-double -maccumulate-outgoing-args -malign-stringops -mfancy-math-387 -mfp-ret-in-387 -mfused-madd -mglibc -mieee-fp -mno-red-zone -mno-sse4 -mpush-args -msahf -mtls-direct-seg-refs Compiler executable checksum: dd9fb97039947d8c4927d069b05a68b5 bool std::rel_ops::operator!=(const _Tp&, const _Tp&) bool std::rel_ops::operator>(const _Tp&, const _Tp&) bool std::rel_ops::operator<=(const _Tp&, const _Tp&) bool std::rel_ops::operator>=(const _Tp&, const _Tp&) void std::swap(_Tp&, _Tp&) std::pair<_T1, _T2>::pair() std::pair<_T1, _T2>::pair(const _T1&, const _T2&) std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) bool std::operator<=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) bool std::operator>=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) std::pair<_T1, _T2> std::make_pair(_T1, _T2) long int std::abs(long int) ldiv_t std::div(long int, long int) long long int __gnu_cxx::abs(long long int) lldiv_t __gnu_cxx::div(long long int, long long int) mpl_::int_::operator int() const mpl_::bool_::operator bool() const mpl_::integral_c::operator T() const mpl_::integral_c::operator bool() const mpl_::size_t::operator size_t() const boost::aligned_storage::aligned_storage() boost::aligned_storage::~aligned_storage() void* boost::aligned_storage::address() const void* boost::aligned_storage::address() const void func1(int&) func1(int&)::_scope_exit_9::_scope_exit_9(int&) func1(int&)::_scope_exit_9::_scope_exit_9(int&) func1(int&)::_scope_exit_9::_scope_exit_9(int&) func1(int&)::_scope_exit_9::~_scope_exit_9() func1(int&)::_scope_exit_9::~_scope_exit_9() func1(int&)::_scope_exit_9::~_scope_exit_9() void func2(T&) func2(T&)::_scope_exit_17::_scope_exit_17(typename __typeof__ (boost::type_of::ensure_obj(scope_exit::wrap_type(t)))::type&) func2(T&)::_scope_exit_17::~_scope_exit_17() int main() void func2(T&) [with T = double] ice.cpp: In constructor 'func2(T&)::_scope_exit_17::_scope_exit_17(typename __typeof__ (boost::type_of::ensure_obj(scope_exit::wrap_type(t)))::type&) [with T = double]': ice.cpp:15: instantiated from 'void func2(T&) [with T = double]' ice.cpp:29: instantiated from here ice.cpp:15: internal compiler error: in tsubst_copy, at cp/pt.c:9723 The same code, but used within a non-template function (func1 in the attached file) and therefore without the typename keyword, does not cause an ICE. This also happens with the other versions of gcc on my machine: $ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3) $ gcc-4.1 -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.3 20080308 (prerelease) (Ubuntu 4.1.2-21ubuntu1) -- Summary: ICE (segv) with typename typeof Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcc at keithr dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37920