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

           Summary: [4.6 regression] g++ SEGV when built with gld on
                    Solaris 10+/x86
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org
                CC: ber...@codesourcery.com
              Host: i386-pc-solaris2.1[01]
            Target: i386-pc-solaris2.1[01]
             Build: i386-pc-solaris2.1[01]


When I recently tried to bootstrap mainline on Solaris 11 (and later 10)/x86
with CVS gas and gld, many C++ testcases failed.  It turned out that g++
SEGVs like this:

% g++ gcc.o
Segmentation Fault

It crashes like this:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
generate_option (opt_index=902, arg=0x8074535 <error reading variable>, 
    value=1, lang_mask=65536, decoded=0x1)
    at /var/gcc/reghunt/trunk/gcc/opts-common.c:862
862       decoded->arg = arg;
(gdb) where
#0  generate_option (opt_index=902, arg=0x8074535 <error reading variable>, 
    value=1, lang_mask=65536, decoded=0x1)
    at /var/gcc/reghunt/trunk/gcc/opts-common.c:862
#1  0x0805a9cb in lang_specific_driver (in_decoded_options=0x80474d8, 
    in_decoded_options_count=0x80474dc, in_added_libraries=0x8093744)
    at /var/gcc/reghunt/trunk/gcc/cp/g++spec.c:324
#2  0x0804c764 in process_command (decoded_options_count=2, 
    decoded_options=0x8093ff8) at /var/gcc/reghunt/trunk/gcc/gcc.c:3597
#3  0x08052f9a in main (argc=2, argv=0x8047664)
    at /var/gcc/reghunt/trunk/gcc/gcc.c:6214

i.e. decoded is invalid.  After searching around for a binutils change that
caused this, it turned out that the problem only happens when gas and gld
are in use, but also with gas/gld 2.20.1.  A gcc reghunt identified the
following patch as the culprit:

2010-09-23  Bernd Schmidt  <ber...@codesourcery.com>

        PR rtl-optimization/44374
        * basic-block.h (enum bb_flags): Add BB_MODIFIED.
        * df-core.c (df_set_bb_dirty): Set it.
        * ifcvt.c (find_memory): Remove function.
        (dead_or_predicable): Use can_move_insns_across.
        * df.h (can_move_insns_across): Declare function.
        * cfgcleanup.c (block_was_dirty): New static variable.
        (try_crossjump_bb, try_forward_edges): Test BB_MODIFIED flag rather
        than df_get_bb_dirty.
        (try_head_merge_bb): New static function.
        (try_optimize_cfg): Call it.  Call df_analyze if block_was_dirty
        is set.
        * df-problems.c: Include "target.h"
        (df_simulate_find_uses): New static function.
        (MEMREF_NORMAL, MEMREF_VOLATILE): New macros.
        (find_memory, find_memory_store): New static functions.
        (can_move_insns_across): New function.
        * Makefile.in (df-problems.o): Update dependencies.

I've not yet identified the mis-compilation caused.

Reply via email to