int bar (int);

void
foo (void)
{
  int b = 0;
  b = bar (b);
  b = bar (b);
  b = bar (b);
  b = bar (b);
  bar (b);
}

compiled with -g -O2 on x86_64-linux results in bogus .debug_loc ranges:
.LLST1:
        .quad   .LVL0-.Ltext0   # Location list begin address (*.LLST1)
        .quad   .LVL1-.Ltext0   # Location list end address (*.LLST1)
        .value  0x2     # Location expression size
        .byte   0x30    # DW_OP_lit0
        .byte   0x9f    # DW_OP_stack_value
        .quad   .LVL1-.Ltext0   # Location list begin address (*.LLST1)
        .quad   .LVL2-1-.Ltext0 # Location list end address (*.LLST1)
        .value  0x1     # Location expression size
        .byte   0x50    # DW_OP_reg0
        .quad   .LVL2-.Ltext0   # Location list begin address (*.LLST1)
        .quad   .LVL2-1-.Ltext0 # Location list end address (*.LLST1)
        .value  0x1     # Location expression size
        .byte   0x50    # DW_OP_reg0
        .quad   .LVL3-.Ltext0   # Location list begin address (*.LLST1)
        .quad   .LVL2-1-.Ltext0 # Location list end address (*.LLST1)
        .value  0x1     # Location expression size
        .byte   0x50    # DW_OP_reg0
        .quad   .LVL4-.Ltext0   # Location list begin address (*.LLST1)
        .quad   .LFE0-.Ltext0   # Location list end address (*.LLST1)
        .value  0x1     # Location expression size
        .byte   0x50    # DW_OP_reg0
        .quad   0x0     # Location list terminator begin (*.LLST1)
        .quad   0x0     # Location list terminator end (*.LLST1)

Some ranges have negative size.


-- 
           Summary: Invalid .debug_loc created
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-debug
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: x86_64-linux


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

Reply via email to