I just tried to compile the following C++ code with
most recent snapshot of gcc version 4.4, dated 20080912.

# include <iostream>
# include <math.h>

using namespace std;

int
main()
{
        for (size_t i = 0; i < 16; ++i)
        {
                cout << i << ' ' << sqrt( i) << '\n';
        }
        return 0;
};

The compiler said

feb25.cc:15: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Here is valgrind providing a stack backtrace.

==3329== Invalid read of size 2
==3329==    at 0x6CE642: invoke_set_current_function_hook (function.c:3867)
==3329==    by 0x9B5721: cgraph_release_function_body (cgraph.c:852)
==3329==    by 0x9B690F: cgraph_remove_node (cgraph.c:967)
==3329==    by 0x9D66BD: cgraph_remove_unreachable_nodes (ipa.c:191)
==3329==    by 0x9BA19B: cgraph_optimize (cgraphunit.c:1271)
==3329==    by 0x49F544: cp_write_global_declarations (decl2.c:3608)
==3329==    by 0x7F7610: toplev_main (toplev.c:979)
==3329==    by 0x52D3435: (below main) (in /lib64/libc-2.8.so)
==3329==  Address 0xa5a5a5a5a5a5a5a5 is not stack'd, malloc'd or (recently)
free'd

Preprocessed source code attached. No special flags required.


-- 
           Summary: ice for simple legal C++ code
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37511

Reply via email to