[Bug go/83992] New: wrong debug info: wrong NOTE_INSN_BLOCK_BEG placement causes
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jan 23 13:10:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83992
Bug ID: 83992
Summary: wrong debug info: wrong NOTE_INSN_BLOCK_BEG placement
causes
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: go
Assignee: ian at airs dot com
Reporter: ubizjak at gmail dot com
CC: cmang at google dot com
Target Milestone: ---
The following problem causes TestCrashDumpsAllThreads gotools testcase failure,
as explained in [1]. The core of the problem is in wrong placement of $LBB
label in the for loop [2].
Following testcase illustrates the problem:
--cut here--
package main
func loop(i int, c chan bool) {
close(c)
for {
for j := 0; j < 0x7fffffff; j++ {
}
}
}
--cut here--
the testcase can be compiled with a crosscompiler to alpha-linux-gnu:
~/gcc-build-alpha/gcc/go1 -O2 -fkeep-static-functions l.go
to generate assembly, where $LBB2 is placed after "lda" insn.
main.loop:
...
$L2:
lda $1,-1($1)
$LBB2:
$LM6:
bne $1,$L2
br $31,$L3
$LBE2:
...
In ._final rtl dump, we can see that (note 52) is in wrong place. It should
be placed in front of (insn 13).
(code_label 14 6 12 2 (nil) [1 uses])
(note 12 14 13 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn:TI 13 12 52 (set (reg:DI 1 $1 [orig:70 ivtmp_1 ] [70])
(plus:DI (reg:DI 1 $1 [orig:70 ivtmp_1 ] [70])
(const_int -1 [0xffffffffffffffff]))) 7 {*adddi_internal}
(nil))
(note 52 13 15 0x7f6b5f2791e0 NOTE_INSN_BLOCK_BEG)
(jump_insn:TI 15 52 45 (set (pc)
(if_then_else (ne (reg:DI 1 $1 [orig:70 ivtmp_1 ] [70])
(const_int 0 [0]))
(label_ref:DI 14)
(pc))) "l.go":6 169 {*bcc_normal}
(int_list:REG_BR_PROB 1062895956 (nil))
-> 14)
(note 45 15 46 [bb 5] NOTE_INSN_BASIC_BLOCK)
(jump_insn:TI 46 45 47 (set (pc)
(label_ref 16)) 200 {jump}
(nil)
-> 16)
(barrier 47 46 32)
(note 32 47 54 NOTE_INSN_DELETED)
(note 54 32 0 0x7f6b5f2791e0 NOTE_INSN_BLOCK_END)
The wrong label placement results in invalid debug_ranges, which are essential
for libbacktrace to determine name of inlined funcion.
[1] https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01842.html
[2] https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01932.html
More information about the Gcc-bugs
mailing list