http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54728
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-11-16 03:36:35 UTC --- here is the most reduced testcase. cat > foo1.cc << EOF template<typename _CharT> struct basic_string { struct _Rep { _CharT* _M_refdata() throw() { return 0; } }; _CharT * dst; static _Rep& _S_empty_rep(); basic_string() : dst(_S_empty_rep()._M_refdata()) { } }; extern template class basic_string<char>; struct basic_ostringstream { basic_string<char> _M_stringbuf; }; basic_ostringstream foo1; EOF sed s/foo1/foo2/ < foo1.cc > foo2.cc g++ -Wfatal-errors t1.cc t2.cc -fpic -flto -c g++ -Wfatal-errors t1.o t2.o -shared -flto -o t.so -flto-partition=none In member function ‘_M_refdata’: lto1: internal compiler error: in input_gimple_stmt, at gimple-streamer-in.c:255 0xc565b6 input_gimple_stmt ....