Repository: go
Issue: gccgo: crash due to running out of memory (likely)
Labels: NeedsInvestigation

<pre>Test case: <a href="http://play.golang.org/p/xoT0jSBOci">http://play.golang.org/p/xoT0jSBOci</a>

Perhaps it's possible to give a nicer error message.

$ gccgo overflow.go 
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
go1: internal compiler error: Aborted
0x99a9ef crash_signal
    /tmp/go-build-release/gccgo-srcdir/gcc/toplev.c:337
0x1063bbc __gnu_cxx::__verbose_terminate_handler()
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/gcc-4_6/libstdc++-v3/libsupc++/vterminate.cc:95
0x10628f5 __cxxabiv1::__terminate(void (*)())
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/gcc-4_6/libstdc++-v3/libsupc++/eh_terminate.cc:40
0x1062922 std::terminate()
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/gcc-4_6/libstdc++-v3/libsupc++/eh_terminate.cc:50
0x1062a55 __cxa_throw
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/gcc-4_6/libstdc++-v3/libsupc++/eh_throw.cc:83
0x1062cfc operator new(unsigned long)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/gcc-4_6/libstdc++-v3/libsupc++/new_op.cc:58
0x104be58 __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/new_allocator.h:92
0x104be58 std::basic_string&lt;char, std::char_traits&lt;char&gt;,
std::allocator&lt;char&gt; &gt;::_Rep::_S_create(unsigned long, unsigned long,
std::allocator&lt;char&gt; const&amp;)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:609
0x104cb3a std::basic_string&lt;char, std::char_traits&lt;char&gt;,
std::allocator&lt;char&gt; &gt;::_Rep::_M_clone(std::allocator&lt;char&gt; const&amp;,
unsigned long)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:631
0x104cc1f std::basic_string&lt;char, std::char_traits&lt;char&gt;,
std::allocator&lt;char&gt; &gt;::reserve(unsigned long)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:512
0x104cc1f std::basic_string&lt;char, std::char_traits&lt;char&gt;,
std::allocator&lt;char&gt; &gt;::reserve(unsigned long)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:503
0x104d11c std::basic_string&lt;char, std::char_traits&lt;char&gt;,
std::allocator&lt;char&gt; &gt;::append(std::basic_string&lt;char,
std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)
    /usr/crosstool/v15/gcc-4.6.x-glibc-2.11.1-grte/x86/debug-src/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:334
0x56ddfd operator+&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;
    /google/src/files/34541112/depot/google3/third_party/crosstool/v15/release/wrappers/x86/bin/../../../gcc/x86/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.x-google/../../../../include/c++/4.6.x-google/bits/basic_string.h:2310
0x56ddfd Binary_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/expressions.cc:5327
0x5914ae Expression::lower(Gogo*, Named_object*, Statement_inserter*, int)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/expressions.h:623
0x5914ae Lower_parse_tree::expression(Expression**)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:1715
0x5914ae Lower_parse_tree::expression(Expression**)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:1703
0x559595 Expression::traverse(Expression**, Traverse*)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/expressions.cc:54
0x59151c Named_constant::traverse_expression(Traverse*)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:4992
0x59151c Lower_parse_tree::constant(Named_object*, bool)
    /tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:1624
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See &lt;<a href="http://go.ext.google.com/go/&gt">http://go.ext.google.com/go/&gt</a>; for instructions.</pre>