http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45939
Summary: negative location ranges generated
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 21996
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=21996
Testcase
When compiling the testcase with -O2 -g a negative location range for a
variable is generated:
00000371 0000000000000174 0000000000000176 (DW_OP_breg10: 4)
00000371 0000000000000176 0000000000000175 (DW_OP_fbreg: -412) [without
DW_AT_frame_base] (start > end)
.8byte .LVL20-.Ltext0 # Location list begin address (*.LLST13)
.8byte .LVL20-1-.Ltext0 # Location list end address (*.LLST13)
.2byte 0x3 # Location expression size
.byte 0x91 # DW_OP_fbreg
The problem seem to arise from call related var_location note to be mixed with
non call related. 209r.vartrack:
(call_insn 150 580 583 20 wrongvainfo.c:31 (parallel [
(call (mem:QI (reg/v/f:DI 6 %r6 [orig:120 getRegUsage ] [120]) [0
S1 A8])
(const_int 0 [0x0]))
(clobber (reg:DI 14 %r14))
]) 546 {*basr} (expr_list:REG_DEAD (reg:DI 4 %r4)
(expr_list:REG_DEAD (reg:DI 3 %r3)
(expr_list:REG_DEAD (reg:DI 2 %r2)
(nil))))
(expr_list:REG_DEP_TRUE (use (reg:DI 4 %r4))
(expr_list:REG_DEP_TRUE (use (reg:DI 3 %r3))
(expr_list:REG_DEP_TRUE (use (reg:DI 2 %r2))
(nil)))))
(note 583 150 582 20 (var_location r (mem/c:SI (plus:DI (reg/f:DI 32 %ap)
(const_int -412 [0xfffffffffffffe64])) [14 %sfp+-252 S4 A32]))
NOTE_INSN_VAR_LOCATION)
(note/c 582 583 581 20 (var_location instr (nil)) NOTE_INSN_VAR_LOCATION)
(note/c 581 582 584 20 (var_location r (reg:SI 14 %r14))
NOTE_INSN_VAR_LOCATION)
For note 582 the LVL20-1 label is being generated while note 583 belongs to
label LVL20. That makes the location range of note 583 to be LVL20...LVL20-1.