[Bug bootstrap/126526] [16, X86] Bootstrap comparison failure!
"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 09:50:10 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126526
--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reproduced with
../configure --prefix=3D/usr --enable-languages=3Dc,c++,go --enable-default=
-pie
--enable-default-ssp --enable-host-pie --disable-multilib --disable-fixincl=
udes
--with-system-zlib --disable-libssp --with-build-config=3D' '
I'd say the problem is in var-tracking,
the NOTE_INSN_VAR_LOCATION notes are in lots of places emitted in different
orders when built with stage1-gcc vs. stage2-gcc, usually it causes no
difference.
But e.g. on input.cc I see
-(note/c 1485 515 1484 57 (var_location line (mem/c:DI (plus:DI (reg/f:DI 16
argp)
- (const_int -232 [0xffffffffffffff18])) [207 %sfp+-168 S8 A64]))
NOTE_INSN_VAR_LOCATION)
-(note/c 1484 1485 1483 57 (var_location __o1 (plus:DI (reg/f:DI 16 argp)
+(note/c 1485 515 1484 57 (var_location __o1 (plus:DI (reg/f:DI 16 argp)
(const_int -160 [0xffffffffffffff60]))) NOTE_INSN_VAR_LOCATION)
-(note/c 1483 1484 1482 57 (var_location line (nil) [uninit])
NOTE_INSN_VAR_LOCATION)
-(note/c 1482 1483 1851 57 (var_location __o (plus:DI (reg/f:DI 16 argp)
+(note/c 1484 1485 1483 57 (var_location line (nil) [uninit])
NOTE_INSN_VAR_LOCATION)
+(note/c 1483 1484 1482 57 (var_location __o (plus:DI (reg/f:DI 16 argp)
(const_int -160 [0xffffffffffffff60]))) NOTE_INSN_VAR_LOCATION)
-(note 1851 1482 921 57 0x7f71205d9478 NOTE_INSN_BLOCK_END)
+(note/c 1482 1483 1851 57 (var_location line (mem/c:DI (plus:DI (reg/f:DI =
16
argp)
+ (const_int -232 [0xffffffffffffff18])) [207 %sfp+-168 S8 A64]))
NOTE_INSN_VAR_LOCATION)
+(note 1851 1482 921 57 0x7f3f21a0c0d0 NOTE_INSN_BLOCK_END)
(insn 921 1851 1486 57 (set (reg:DI 37 r9 [orig:276 line ] [276])
(mem/c:DI (plus:DI (reg/f:DI 7 sp)
(const_int 40 [0x28])) [207 %sfp+-168 S8 A64]))
"../../gcc/input.cc":220:8 discrim 2 99 {*movdi_internal}
(nil))
(note 1486 921 919 57 (var_location line (nil) [uninit])
NOTE_INSN_VAR_LOCATION)
Here, the ordering of var_location for line matters. When built with
stage1-gcc (- lines, the location with [argp-232] comes first and after tha=
t a
reset for that,
while when built with stage2-gcc (+ lines, line is first reset and then
[argp-232]. The last one wins if there are no insns in between, so for + we
need to emit
extra label:
.LVL137:
- # DEBUG line =3D> [argp-0xe8]
# DEBUG __o1 =3D> argp-0xa0
# DEBUG line RESET
# DEBUG __o =3D> argp-0xa0
+ # DEBUG line =3D> [argp-0xe8]
# ../../gcc/input.cc:220:8
.loc 1 220 8 is_stmt 0 discriminator 1 view .LVU380
.LBE825:
# ../../gcc/input.cc:220:8
.loc 1 220 8 discriminator 2 view .LVU381
#(insn 921 1851 1486 57 (set (reg:DI 37 r9 [orig:276 line ] [276])
# (mem/c:DI (plus:DI (reg/f:DI 7 sp)
# (const_int 40 [0x28])) [207 %sfp+-168 S8 A64]))
"../../gcc/input.cc":220:8 discrim 2 99 {*movdi_internal}
# (nil))
movq 40(%rsp), %r9 # 921 [c=3D6 l=3D5] *movdi_internal/3
+.LVL138:
+ # DEBUG line RESET
# ../../gcc/input.cc:220:8
.loc 1 220 8 discriminator 2 view .LVU382
#(insn 919 1486 516 57 (set (reg:DI 39 r11)
# (zero_extend:DI (mem/c:SI (plus:DI (reg/f:DI 7 sp)
# (const_int 8 [0x8])) [207 %sfp+-200 S4 A64])))
"../../gcc/input.cc":220:8 discrim 2 179 {*zero_extendsidi2}
# (nil))
movl 8(%rsp), %r11d # 919 [c=3D7 l=3D5] *zero_extendsidi2/3
and the debug info for line on the single instruction is different.
There is no such difference before var-tracking,
(debug_insn 511 918 515 57 (debug_marker) "../../gcc/input.cc":220:8 discr=
im 1
-1
(nil))
-(call_insn:TI 515 511 921 57 (call (mem:QI (symbol_ref:DI
("_obstack_newchunk") [flags 0x41] <function_decl 0x7f7121b11d00
_obstack_newchunk>) [0 _obstack_newchunk S1 A8])
+(call_insn:TI 515 511 921 57 (call (mem:QI (symbol_ref:DI
("_obstack_newchunk") [flags 0x41] <function_decl 0x7f3f22c1bb00
_obstack_newchunk>) [0 _obstack_newchunk S1 A8])
(const_int 0 [0])) "../../gcc/input.cc":220:8 discrim 1 1497 {*cal=
l}
(expr_list:REG_DEAD (reg:DI 5 di)
(expr_list:REG_DEAD (reg:DI 4 si)
- (expr_list:REG_CALL_DECL (symbol_ref:DI ("_obstack_newchunk")
[flags 0x41] <function_decl 0x7f7121b11d00 _obstack_newchunk>)
+ (expr_list:REG_CALL_DECL (symbol_ref:DI ("_obstack_newchunk")
[flags 0x41] <function_decl 0x7f3f22c1bb00 _obstack_newchunk>)
(nil))))
(expr_list:DI (use (reg:DI 5 di))
(expr_list:DI (use (reg:DI 4 si))
(nil))))
(insn 921 515 919 57 (set (reg:DI 37 r9 [orig:276 line ] [276])
(mem/c:DI (plus:DI (reg/f:DI 7 sp)
(const_int 40 [0x28])) [207 %sfp+-168 S8 A64]))
"../../gcc/input.cc":220:8 discrim 2 99 {*movdi_internal}
(nil))
(insn 919 921 516 57 (set (reg:DI 39 r11)
(zero_extend:DI (mem/c:SI (plus:DI (reg/f:DI 7 sp)
(const_int 8 [0x8])) [207 %sfp+-200 S4 A64])))
"../../gcc/input.cc":220:8 discrim 2 179 {*zero_extendsidi2}
(nil))
where the changes are the usual differences.
Now, dunno if we ever cared about this (though, having a reproduceable outp=
ut
including debug info is certainly desirable).=