g++ test1.ii test1.cpp: In function ‘int main()’: test1.cpp:21: internal compiler error: in gimplify_expr, at gimplify.c:4519 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>. Preprocessed source stored into /tmp/ccICvwkX.out file, please attach this to your bugreport.
Created attachment 13308 [details] This is sample code which causes ICE under GCC
Confirmed.
Reducing...
Testcase: namespace std { template < class T > class allocator { public:typedef T value_type; typedef long unsigned int size_type; ~allocator () { } }; template < class charT > struct char_traits { }; template < class T, class Allocator > class vector { }; template < class Ch, class Tr = char_traits < Ch >, class A = allocator < Ch > >class basic_string; typedef basic_string < char >string; template < class Ch, class Tr, class A > class basic_string:public std::vector < Ch, A > { public:typedef Tr traits_type; typedef typename A::size_type size_type; static const size_type npos = (size_type) - 1; basic_string (const basic_string & str, size_type pos = 0, size_type n = npos, const A & al = A ()); }; } using namespace std; main () { try { } catch (string smess) { } }
This also happens with 4.3. I cannot check 4.0.
Really reduced testcase: struct allocator{ ~allocator() throw(); }; struct string { string(const string& str, const allocator& al = allocator()); }; int main() { try {} catch (string smess) {} }
A regression hunt identified the tree-ssa merge to mainline.
Subject: Bug 31411 Author: jason Date: Tue Sep 4 18:37:33 2007 New Revision: 128100 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128100 Log: PR c++/31411 * except.c (initialize_handler_parm): Put a CLEANUP_POINT_EXPR inside the MUST_NOT_THROW_EXPR. Added: trunk/gcc/testsuite/g++.dg/eh/catch5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/except.c
Fixed for 4.2.2.