public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/101383] New: GCC 11 Reproducibility Issue
@ 2021-07-09  7:42 toolybird at tuta dot io
  2021-07-09  8:35 ` [Bug other/101383] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: toolybird at tuta dot io @ 2021-07-09  7:42 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
@ 2021-07-09  8:35 ` rguenth at gcc dot gnu.org
  2021-07-09  8:53 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-09  8:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The difference you show lists temporary assembler filenames - I don't see
any of those in a local bootstrap (but I just have trunk lying around).

cc1-checksum is copied to make the checksum the same on all stages.

The flags are different between stage2 and stage3 to increase coverage
of the same-code check (once with debug, once without) and to make
the build faster (do less checking using the very slow stage1 compiler).

The cc1-checksum is a source of difference between builds, at SUSE we carry
a local patch to null that and instead use the linker build-id as checksum
for PCH purposes.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
  2021-07-09  8:35 ` [Bug other/101383] " rguenth at gcc dot gnu.org
@ 2021-07-09  8:53 ` rguenth at gcc dot gnu.org
  2021-07-09  8:58 ` [Bug debug/101383] " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-09  8:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
How did you configure / make and on what host / target?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
  2021-07-09  8:35 ` [Bug other/101383] " rguenth at gcc dot gnu.org
  2021-07-09  8:53 ` rguenth at gcc dot gnu.org
@ 2021-07-09  8:58 ` rguenth at gcc dot gnu.org
  2021-07-09  9:08 ` [Bug driver/101383] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-09  8:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|other                       |debug

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Huh, I can indeed see temporary filenames in debug in some cases - trying to
see what triggers it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug driver/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
                   ` (2 preceding siblings ...)
  2021-07-09  8:58 ` [Bug debug/101383] " rguenth at gcc dot gnu.org
@ 2021-07-09  9:08 ` rguenth at gcc dot gnu.org
  2021-07-09  9:12 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-09  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
          Component|debug                       |driver
   Last reconfirmed|                            |2021-07-09
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I can for example trigger it with

gcc -c t.c -Wa,--gdwarf-5

or also

gcc -c t.c -g -gtoggle

where despite treating -g -gtoggle as -g0 we still end up passing --gdwarf-5 to
the assembler.  So this way will cause different stage2 checksum (since
stage2 is built with -g -gtoggle) and that's re-used for stage3 and thus
causes the difference (in just the checksum).

It looks like debug-level-gt is not affected by -gtoggle
(gcc.c:debug_level_greater_than_spec_func) or too late for the driver to
notice.
In fact it seems to be handled in the compiler only (process_options).

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug driver/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
                   ` (3 preceding siblings ...)
  2021-07-09  9:08 ` [Bug driver/101383] " rguenth at gcc dot gnu.org
@ 2021-07-09  9:12 ` rguenth at gcc dot gnu.org
  2021-07-09 21:04 ` toolybird at tuta dot io
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-09  9:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following simple patch seems to work:

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 36a88fc99b0..16da5a0b46b 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -10831,7 +10831,7 @@ debug_level_greater_than_spec_func (int argc, const
char **argv)
   long arg = strtol (argv[0], &converted, 10);
   gcc_assert (converted != argv[0]);

-  if (debug_info_level > arg)
+  if (!flag_gtoggle && debug_info_level > arg)
     return "";

   return NULL;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug driver/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
                   ` (4 preceding siblings ...)
  2021-07-09  9:12 ` rguenth at gcc dot gnu.org
@ 2021-07-09 21:04 ` toolybird at tuta dot io
  2021-07-15  5:56 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: toolybird at tuta dot io @ 2021-07-09 21:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

--- Comment #6 from Toolybird <toolybird at tuta dot io> ---
The patch you posted to gcc-patches solves my problem.

Thank you for the quick fix!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug driver/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
                   ` (5 preceding siblings ...)
  2021-07-09 21:04 ` toolybird at tuta dot io
@ 2021-07-15  5:56 ` cvs-commit at gcc dot gnu.org
  2021-07-15  6:34 ` cvs-commit at gcc dot gnu.org
  2021-07-15  6:35 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-15  5:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:4f3b383cf8825197e714a4a21852eca071f8e67e

commit r12-2318-g4f3b383cf8825197e714a4a21852eca071f8e67e
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jul 9 11:13:11 2021 +0200

    driver/101383 - handle -gtoggle in driver

    The driver amends assembler options with for example --gdwarf-5
    when debugging is enabled but the check for that does not consider
    the effect of -gtoggle which is not handled in the common option
    machinery.  The following alters debug_info_level according to
    -gtoggle mimicing what process_options later does in the compiler.

    This in particular avoids changing of the cc1-checksum with every
    bootstrap (debug) cycle as we compute that from stage2 where we
    use -g -gtoggle but with --gdwarf-5 and no debug info from the
    compiler the assembler will fill the line table with the temporary
    assembler file names.

    2021-07-09  Richard Biener  <rguenther@suse.de>

            PR driver/101383
            * gcc.c (process_command): Process -gtoggle like process_options
            would after parsing options.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug driver/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
                   ` (6 preceding siblings ...)
  2021-07-15  5:56 ` cvs-commit at gcc dot gnu.org
@ 2021-07-15  6:34 ` cvs-commit at gcc dot gnu.org
  2021-07-15  6:35 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-15  6:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:018eac577730e1a8b0d589b4223c23fdaf030a5f

commit r11-8753-g018eac577730e1a8b0d589b4223c23fdaf030a5f
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jul 9 11:13:11 2021 +0200

    driver/101383 - handle -gtoggle in driver

    The driver amends assembler options with for example --gdwarf-5
    when debugging is enabled but the check for that does not consider
    the effect of -gtoggle which is not handled in the common option
    machinery.  The following alters debug_info_level according to
    -gtoggle mimicing what process_options later does in the compiler.

    This in particular avoids changing of the cc1-checksum with every
    bootstrap (debug) cycle as we compute that from stage2 where we
    use -g -gtoggle but with --gdwarf-5 and no debug info from the
    compiler the assembler will fill the line table with the temporary
    assembler file names.

    2021-07-09  Richard Biener  <rguenther@suse.de>

            PR driver/101383
            * gcc.c (process_command): Process -gtoggle like process_options
            would after parsing options.

    (cherry picked from commit 4f3b383cf8825197e714a4a21852eca071f8e67e)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug driver/101383] GCC 11 Reproducibility Issue
  2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
                   ` (7 preceding siblings ...)
  2021-07-15  6:34 ` cvs-commit at gcc dot gnu.org
@ 2021-07-15  6:35 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-15  6:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101383

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |11.1.1
      Known to fail|                            |11.1.0

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-07-15  6:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09  7:42 [Bug other/101383] New: GCC 11 Reproducibility Issue toolybird at tuta dot io
2021-07-09  8:35 ` [Bug other/101383] " rguenth at gcc dot gnu.org
2021-07-09  8:53 ` rguenth at gcc dot gnu.org
2021-07-09  8:58 ` [Bug debug/101383] " rguenth at gcc dot gnu.org
2021-07-09  9:08 ` [Bug driver/101383] " rguenth at gcc dot gnu.org
2021-07-09  9:12 ` rguenth at gcc dot gnu.org
2021-07-09 21:04 ` toolybird at tuta dot io
2021-07-15  5:56 ` cvs-commit at gcc dot gnu.org
2021-07-15  6:34 ` cvs-commit at gcc dot gnu.org
2021-07-15  6:35 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).