https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383
Bug ID: 101383 Summary: GCC 11 Reproducibility Issue Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: toolybird at tuta dot io Target Milestone: --- Performing 2 consecutive runs of a normal 3-stage bootstrap results in differing cc1 and cc1plus binaries. This appears to be a regression since GCC 10 does not exhibit the problem. The issue can be pinpointed to cc1-checksum.c and cc1plus-checksum.c I know very little about this stuff but I suspect the root cause is due to the move to DWARF 5 Please note: This is a standard `make' which means default BOOT_CFLAGS of "-g -O2". Comparing the saved object files between runs with `readelf -w' reveals differences with GCC 11 whereas with GCC 10 they are identical. For example with GCC 11: $ cmp -lb gcc-build.1st/prev-gcc/c/c-lang.o gcc-build.2nd/prev-gcc/c/c-lang.o 1932 130 X 114 L 1933 62 2 60 0 1934 171 y 142 b 1935 127 W 71 9 1936 150 h 153 k 1937 121 Q 126 V 1943 130 X 114 L 1944 62 2 60 0 1945 171 y 142 b 1946 127 W 71 9 1947 150 h 153 k 1948 121 Q 126 V 2066 130 X 114 L 2067 62 2 60 0 2068 171 y 142 b 2069 127 W 71 9 2070 150 h 153 k 2071 121 Q 126 V $ readelf -w gcc-build.1st/prev-gcc/c/c-lang.o > 1.txt $ readelf -w gcc-build.2nd/prev-gcc/c/c-lang.o > 2.txt $ diff -u 1.txt 2.txt --- 1.txt 2021-07-09 17:20:09.504532430 +1000 +++ 2.txt 2021-07-09 17:20:26.174675615 +1000 @@ -34,8 +34,8 @@ The File Name Table (offset 0x30, lines 2, columns 2): Entry Dir Name - 0 0 (indirect line string, offset: 0xa): ccX2yWhQ.s - 1 1 (indirect line string, offset: 0x15): ccX2yWhQ.s + 0 0 (indirect line string, offset: 0xa): ccL0b9kV.s + 1 1 (indirect line string, offset: 0x15): ccL0b9kV.s Line Number Statements: [0x0000003a] Extended opcode 2: set Address to 0x0 @@ -55,8 +55,8 @@ Contents of the .debug_line_str section: - 0x00000000 2f746d70 002f746d 70006363 58327957 /tmp./tmp.ccX2yW - 0x00000010 68512e73 00636358 32795768 512e7300 hQ.s.ccX2yWhQ.s. + 0x00000000 2f746d70 002f746d 70006363 4c306239 /tmp./tmp.ccL0b9 + 0x00000010 6b562e73 0063634c 3062396b 562e7300 kV.s.ccL0b9kV.s. <...snip...> >From looking at the Makefiles, it appears `cc1-checksum.c' is copied from the previous stage for some reason, which I think might be pertinent. It also seems like different flags are used between stages 2 and 3: -DIN_GCC_FRONTEND -g -O2 -fno-checking -gtoggle -DIN_GCC -DIN_GCC_FRONTEND -g -O2 -fchecking=1 -DIN_GCC Any comments? Thanks.