This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xgcc: Internal error: Segmentation fault (program as)


In article <20010328141211.E218@stanford.edu> you wrote:
: as from binutils 2.11.90.0.1 crashes while compiling libstdc++ from
: the gcc CVS trunk.

I don't know enough about gas internals to fix the bug, but I can add
a few things to characterize it better:

- The trouble comes from resolving a local symbol (to 0, no less, even
  though it shouldn't be zero) first due to a difference expression,
  and then later trying to write out the symbol, where the symbol is not
  tested for being resolved first.

- The gas bug has been around for some time; it also occurs with
  GNU assembler 2.10.90 (from Red Hat Linux 7).  It is triggered by
  a local label being shared for a jump destination and a difference
  expression, plus a few extra bits around them, most notably section
  switches.  No special options are necessary to trigger the bug.

This is the reduced testcase:

        .section        .gcc_except_table,"aw",@progbits
        .section        .text._ZNKSt6localeeqERKS_,"ax",@progbits
.LFB17:
        jmp     .L363
.L363:
        .section        .gcc_except_table,"aw",@progbits
        .uleb128 .L363-.LFB17

This is the point where the symbol is resolved
(for the oroginal local.s testcase):

Hardware watchpoint 22: *$47

Old value = (fragS *) 0x81773b0
New value = (fragS *) 0x0
resolve_symbol_value (symp=0x8179504, finalize=1)
    at /s/fsf/egcs/gas/symbols.c:855
855           return final_val;
(gdb) p *locsym
No symbol "locsym" in current context.
(gdb) p *symp  
$48 = {bsym = 0x0, sy_value = {X_add_symbol = 0x816e050, 
    X_op_symbol = 0x81794fc, X_add_number = 0, X_op = O_illegal, 
    X_unsigned = 0, X_md = 0}, sy_next = 0x45424c2e, sy_previous = 0x3234, 
  sy_frag = 0x0, written = 0, sy_resolved = 0, sy_resolving = 0, 
  sy_used_in_reloc = 0, sy_used = 1, sy_mri_common = 0, sy_obj = {
    local = 135763224, size = 0x8177108, versioned_name = 0x0}, local = 0}
(gdb) p *(struct local_symbol *)symp
$49 = {lsy_marker = 0x0, lsy_section = 0x816e050, 
  lsy_name = 0x81794fc ".L363", u = {lsy_frag = 0x0, lsy_sym = 0x0}, 
  lsy_offset = 0}
(gdb) p final_val
$50 = 0
(gdb) p bfd_octets_per_byte (stdoutput)
$51 = 1
(gdb) finish                   
Run till exit from #0  resolve_symbol_value (symp=0x8179504, finalize=1)
    at /s/fsf/egcs/gas/symbols.c:855
resolve_symbol_value (symp=0x8179d38, finalize=1)
    at /s/fsf/egcs/gas/symbols.c:1000
1000              right = resolve_symbol_value (op_symbol, finalize);
Value returned is $52 = 0
(gdb) p *(struct local_symbol *)*$20
$53 = {lsy_marker = 0x0, lsy_section = 0x816e050, 
  lsy_name = 0x81794fc ".L363", u = {lsy_frag = 0x0, lsy_sym = 0x0}, 
  lsy_offset = 0}
(gdb) p finalize
$54 = 1
(gdb) p ((fragS *) 0x81773b0)->fr_adress
There is no member named fr_adress.
(gdb) p *((fragS *) 0x81773b0)           
$55 = {fr_address = 0, fr_next = 0x81773f0, fr_fix = 7, fr_var = 52, 
  fr_symbol = 0x8179288, fr_offset = 0, fr_opcode = 0x81773ea "ë", line = 0x0, 
  relax_marker = 0, fr_type = rs_machine_dependent, fr_subtype = 4, 
  fr_file = 0xbffffa0c "locale.s", fr_line = 3328, fr_literal = "\211"}
(gdb) p ((fragS *) 0x81773b0)->fr_address


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]