https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125366
--- Comment #12 from Michal Kowalewski <m.kowalewski at outlook dot com> ---
(In reply to Sam James from comment #8)
> Ah, sorry for missing it.
>
> It's similar to the previous issues we saw with gimple-match and insn-recog
> and it looked like it might be a compare-debug problem, and I didn't manage
> to reduce it.
>
> ```
> $ ~/git/gcc/contrib/compare-lto -p stage2-gimple-match-5.o
> stage3-gimple-match-5.o
> stage2-gimple-match-5.o stage3-gimple-match-5.o differ: byte 41, line 1
> stripping off LTO option section, then retrying
> stage2-gimple-match-5.o.stripped. stage3-gimple-match-5.o.stripped. differ:
> byte 174771, line 644
> preserving stage2-gimple-match-5.o.stripped.
> stage3-gimple-match-5.o.stripped.
> $ diffoscope stage{2,3}-gimple-match-5.o.stripped -text-color=always | less
> -R
> --- stage2-gimple-match-5.o.stripped
> +++ stage3-gimple-match-5.o.stripped
> ├── readelf --wide --sections {}
> │ @@ -7,188 +7,188 @@
> │ [ 2] .data PROGBITS 0000000000000000 000040 000000
> 00 WA 0 0 1
> │ [ 3] .bss NOBITS 0000000000000000 000040 000000
> 00 WA 0 0 1
> │ [ 4] .gnu.lto_.odr_types.1 PROGBITS 0000000000000000 000040
> 025088 00 E 0 0 1
> │ [ 5] .gnu.lto_.profile.1 PROGBITS 0000000000000000 0250c8 000095
> 00 E 0 0 1
> │ [ 6] .gnu.lto_.icf.1 PROGBITS 0000000000000000 02515d 0014c3
> 00 E 0 0 1
> │ [ 7] .gnu.lto_.ipa_sra.1 PROGBITS 0000000000000000 026620 000e89
> 00 E 0 0 1
> │ [ 8] .gnu.lto_.inline.1 PROGBITS 0000000000000000 0274a9 0035f1
> 00 E 0 0 1
> │ - [ 9] .gnu.lto_.jmpfuncs.1 PROGBITS 0000000000000000 02aa9a
> 003edf 00 E 0 0 1
> │ - [10] .gnu.lto_.pureconst.1 PROGBITS 0000000000000000 02e979
> 00018f 00 E 0 0 1
> │ - [11] .gnu.lto_.ipa_modref.1 PROGBITS 0000000000000000 02eb08
> 000a85 00 E 0 0 1
> │ - [12] .gnu.lto_.lto.1 PROGBITS 0000000000000000 02f58d 000008
> 00 E 0 0 1
> [...]
> │ + [ 9] .gnu.lto_.jmpfuncs.1 PROGBITS 0000000000000000 02aa9a
> 003ee2 00 E 0 0 1
> │ + [10] .gnu.lto_.pureconst.1 PROGBITS 0000000000000000 02e97c
> 00018f 00 E 0 0 1
> │ + [11] .gnu.lto_.ipa_modref.1 PROGBITS 0000000000000000 02eb0b
> 000a86 00 E 0 0 1
> │ + [12] .gnu.lto_.lto.1 PROGBITS 0000000000000000 02f591 000008
> 00 E 0 0 1
> [...]
> $ objcopy -O binary --set-section-flags *=ALLOC -j .gnu.lto_.jmpfuncs.1
> stage2-gimple-match-5.o.stripped jmpfuncs.stage2.z
> $ objcopy -O binary --set-section-flags *=ALLOC -j .gnu.lto_.jmpfuncs.1
> stage3-gimple-match-5.o.stripped jmpfuncs.stage3.z
> $ diffoscope jmpfuncs.stage{2,3}
> --- jmpfuncs.stage2
> +++ jmpfuncs.stage3
> @@ -145,22 +145,22 @@
> 00000900: 7f04 8101 0100 0001 0202 8f01 4001 0140 ............@..@
> 00000910: 017f 4001 0040 017f 0201 d601 0001 0202 ..@..@..........
> 00000920: af01 0140 01d0 0040 01d0 0040 01d0 0040 ...@...@...@...@
> 00000930: 0100 0200 0000 0400 0001 0202 8e01 0140 ...............@
> 00000940: 0100 4001 0140 0100 4001 0102 01bc 0100 ..@..@..@.......
> 00000950: 0102 028e 0101 4001 0040 0100 4001 0040 ......@..@..@..@
> 00000960: 0100 2102 0101 0f7f 0293 017f 0220 0400 ..!.......... ..
> -00000970: 0001 0202 b401 0120 0100 2001 ffff 0320 ....... .. ....
> +00000970: 0001 0202 8801 0120 0100 2001 ffff 0320 ....... .. ....
> 00000980: 0100 2001 ffff 0300 0001 0202 a201 0120 .. ............
> 00000990: 0100 2001 0120 0100 2001 0104 0000 0000 .. .. .. .......
> 000009a0: 0001 0202 2940 0101 4001 7f40 0100 4001 ....)@..@..@..@.
> 000009b0: 7804 0000 0102 028e 0101 4001 0040 0101 x.........@..@..
> 000009c0: 4001 0040 0101 0201 bc01 0001 0202 8e01 @..@............
> 000009d0: 0140 0100 4001 0040 0100 4001 0002 0000 .@..@..@..@.....
> -000009e0: 0004 0000 0102 02b4 0101 2001 0020 01ff .......... .. ..
> +000009e0: 0004 0000 0102 0288 0101 2001 0020 01ff .......... .. ..
> [...]
> ```
>
> If you take the two command lines for gimple-match-5.o with stage2 and also
> stage3, and run them manually, you should still see a differing
> gimple-match-5.o after compare-lto -p (you need compare-lto to strip the
> options section). If you then run them again with say -g0 on both, does
> compare-lto then pass?
compare-lto still fails, and the files seem identical (since I've already built
them with stripped with -s). I also tried bootstrapping with the same flags on
another machine with AMD 7950X where -march=native expands to znver4, and
surprisingly, more objects failed the comparison:
gcc/i386-expand.o
gcc/gimple-match-5.o
gcc/analyzer/sm-fd.o
gcc/cp/parser.o
So the -march switch does affect this bug. I am including gimple-match-5
objects from the zen 4 build.