[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-05-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #11 from Richard Biener  ---
Author: rguenth
Date: Tue May  8 08:50:33 2018
New Revision: 260026

URL: https://gcc.gnu.org/viewcvs?rev=260026=gcc=rev
Log:
2018-05-08  Richard Biener  

PR bootstrap/85571
config/
* bootstrap-lto-noplugin.mk: Disable compare.
* bootstrap-lto.mk: Supply contrib/compare-lto for do-compare.

contrib/
* compare-lto: New script derived from compare-debug.

Added:
trunk/contrib/compare-lto   (with props)
Modified:
trunk/config/ChangeLog
trunk/config/bootstrap-lto-noplugin.mk
trunk/config/bootstrap-lto.mk
trunk/contrib/ChangeLog

Propchange: trunk/contrib/compare-lto
('svn:executable' added)

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-05-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from Richard Biener  ---
Fixed.

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #10 from Richard Biener  ---
On the gcc-8 branch cc1 and friends compare OK so this is a recent regression. 
Will try with checking enabled to be extra sure.  Then there are only few
changes on trunk that are suspicious.

+/* Compare types based on source file location.  */
+
+static int
+cmp_type_location (const void *p1_, const void *p2_)
+{
+  tree *p1 = (tree*)(const_cast(p1_));
+  tree *p2 = (tree*)(const_cast(p2_));
+  if (*p1 == *p2)
+return 0;
+
+  tree tname1 = TYPE_NAME (*p1);
+  tree tname2 = TYPE_NAME (*p2);
+
+  const char *f1 = DECL_SOURCE_FILE (tname1);
+  const char *f2 = DECL_SOURCE_FILE (tname2);
+
+  int r = strcmp (f1, f2);
+  if (r == 0)

this should probably split paths.

+  /* Register ODR types.  */
+  for (unsigned i = 0; i < odr_types.length (); i++)
+register_odr_type (odr_types[i]);

I suspect the order may have effects on code-generation.

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread hubicka at ucw dot cz
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #9 from Jan Hubicka  ---
> 
> so different BB re-ordering / partitioning?

That would be probably best visible from bb-reorder dumps. However...
> 
> For example in the case of gengtype from stage2/stage3 .text has the same size
> but .debug_info size differs by one byte.  But gentype code differs as well:
> 
> @@ -2884,6 +2884,7 @@
>xx:  xx xx xx xx xx  xxllq  xx <_ZLxxpxxk_state_tokeni>
>xx:  xx xx xx xx xx  mov$0x1,%xxi
>xx:  xx xx xxmov%rax,%rxx
> +  xx:  xx xx xx xx mov%rax,(%rsp)

This is something else and such changes may make partitioning to diverge. So
perhaps
first debug this one?
>xx:  xx xx xx xx xx  xxllq  xx <_ZLxxpxxk_state_tokeni>
>xx:  xx xx xx xx xx  mov$0x2,%xxi
>xx:  xx xx xxmov%rax,%rbp
> ...
> 
> -- 
> You are receiving this mail because:
> You reported the bug.

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #8 from Richard Biener  ---
So even w/o the -f[no-]checking flags I see then when comparing stage2 and
stage3 cc1:

> readelf -S /abuild/rguenther/obj/prev-gcc/cc1 | grep -C 1 .text
   0008  0008  AX   0 0 8
  [14] .text PROGBITS 0057be60  0017be60
   00feb92a    AX   0 0 16
> readelf -S /abuild/rguenther/obj/gcc/cc1 | grep -C 1 .text
   0008  0008  AX   0 0 8
  [14] .text PROGBITS 0057be60  0017be60
   00feb5ba    AX   0 0 16

assembly shows (after stripping reloc offset differences - bah, objdump
should have a way to substitute zero for all of those):

@@ -11420,24 +11420,6 @@
   xx:  xx xx xxmov%rxx,%rdi
   xx:  xx xx xx xx xx  mov$0xb,%esi
   xx:  xx xx xx xx xx  xxllq  xx
<_Zxxtrxx_contains_struct_chxxk_xxilxx
PK9trxx_noxxtrxx_noxx_structure_enumPKciS4_>
-  xx:  xx xx xxmov%r8,%rdi
-  xx:  xx xx xx xx xx  xxllq  xx
<_ZLxxi_tag_bindingP9trxx_noxx.part.xx
>
-  xx:  xx xx xxmov%rxx,%rdi
-  xx:  xx xx xx xx xx  xxllq  xx
<_ZLxxi_symbol_bindingP9trxx_noxx.part
.xx>
-  xx:  xx xx xxmov%r8,%rdi
-  xx:  xx xx xx xx xx  xxllq  xx
<_ZLxxi_tag_bindingP9trxx_noxx.part.xx
>
-  xx:  xx xx xxmov%rxx,%rdi
-  xx:  xx xx xx xx xx  xxllq  xx
<_ZLxxi_symbol_bindingP9trxx_noxx.part
.xx>
-  xx:  xx xx xx xx xx  mov$0xxx,%xxx
-  xx:  xx xx xx xx xx  mov$0xxx,%esi
-  xx:  xx xx xx xx xx  mov$0xxx,%xxi
-  xx:  xx xx xx xx xx  xxllq  xx <_Zxxncy_xxortPKciS0_>
-  xx:  xx xx xx xx xx xx   mov$0xxx,%rxx
-  xx:  xx xx xx xx xx  mov$0xxx,%xxx
-  xx:  xx xx xx xx xx  mov$0xxx,%xxx
-  xx:  xx xx xxmov%rxx,%rdi
-  xx:  xx xx xx xx xx  mov$0x1,%esi
-  xx:  xx xx xx xx xx  xxllq  xx
<_Zxxtrxx_contains_struct_chxxk_xxilxxPK9trxx_noxxtrxx_noxx_structure_enumPKciS4_>
   xx:  xx xx xx xx xx xx   mov$0xxx,%rxx
   xx:  xx xx xx xx xx  mov$0xxx,%xxx
   xx:  xx xx xx xx xx  mov$0xxx,%xxx
@@ -11480,6 +11462,20 @@
   xx:  xx xx xx xx xx  mov$0xxx,%esi
   xx:  xx xx xxmov%rxx,%rdi
   xx:  xx xx xx xx xx  xxllq  xx
<_Zxxtrxx_chxxk_xxilxxPK9trxx_noxxPKciS3_z>
+  xx:  xx xx xxmov%r8,%rdi
+  xx:  xx xx xx xx xx  xxllq  xx
<_ZLxxi_tag_bindingP9trxx_noxx.part.xx>
+  xx:  xx xx xxmov%rxx,%rdi
+  xx:  xx xx xx xx xx  xxllq  xx
<_ZLxxi_symbol_bindingP9trxx_noxx.part.xx>
+  xx:  xx xx xx xx xx  mov$0xxx,%xxx
+  xx:  xx xx xx xx xx  mov$0xxx,%esi
+  xx:  xx xx xx xx xx  mov$0xxx,%xxi
+  xx:  xx xx xx xx xx  xxllq  xx <_Zxxncy_xxortPKciS0_>
+  xx:  xx xx xx xx xx xx   mov$0xxx,%rxx
+  xx:  xx xx xx xx xx  mov$0xxx,%xxx
+  xx:  xx xx xx xx xx  mov$0xxx,%xxx
+  xx:  xx xx xxmov%rxx,%rdi
+  xx:  xx xx xx xx xx  mov$0x1,%esi
+  xx:  xx xx xx xx xx  xxllq  xx
<_Zxxtrxx_contains_struct_chxxk_xxilxxPK9trxx_noxxtrxx_noxx_structure_enumPKciS4_>
   xx:  xx xx xx xx xx xx   mov$0xxx,%rxx
   xx:  xx xx xx xx xx  mov$0xxx,%xxx
   xx:  xx xx xx xx xx  mov$0xxx,%xxx
...

 xx <_ZLxx_parser_postfix_expressionPxx_parser.cold.xx>:
-  xx:  xx xx xx xx xx  xxllq  xx
<_ZN3vxxIxxva_hxxp6vl_ptrExxquick_pushERKb.isra.xx.part.xx>
+  xx:  xx xx xx xx xx  xxllq  xx
<_ZN3vxxIxxva_hxxp6vl_ptrEixEj.isra.xx.part.xx>
   xx:  xx xx xx xx xx xx   mov$0xxx,%rxx

so different BB re-ordering / partitioning?

For example in the case of gengtype from stage2/stage3 .text has the same size
but .debug_info size differs by one byte.  But gentype code differs as well:

@@ -2884,6 +2884,7 @@
   xx:  xx xx xx xx xx  xxllq  xx <_ZLxxpxxk_state_tokeni>
   xx:  xx xx xx xx xx  mov$0x1,%xxi
   xx:  xx xx xxmov%rax,%rxx
+  xx:  xx xx xx xx mov%rax,(%rsp)
   xx:  xx xx xx xx xx  xxllq  xx <_ZLxxpxxk_state_tokeni>
   xx:  xx xx xx xx xx  mov$0x2,%xxi
   xx:  xx xx xxmov%rax,%rbp
...

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #7 from Richard Biener  ---
Created attachment 44041
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44041=edit
patch

Like this.  Will fail as well because cc1 will differ (does not differ without
LTO).

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #6 from Richard Biener  ---
Or more sophisticated allow to override/amend what we compare in the .mk
snippets
and compare $(exeext) instead of ($objext) for bootstrap-lto.

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #5 from Richard Biener  ---
The following should work:

Index: config/bootstrap-lto.mk
===
--- config/bootstrap-lto.mk (revision 259755)
+++ config/bootstrap-lto.mk (working copy)
@@ -1,5 +1,7 @@
 # This option enables LTO for stage2 and stage3 in slim mode

+do-compare = /bin/true
+
 STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1
 STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1
 STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #4 from Richard Biener  ---
contrib/compare-debug strips off LTO sections but that would leave us with a
no-op compare.  On any target using non-native sections just stripping
.gnu.lto_.opts
will be difficult in such script, so we'd need to build a compare-lto tool
and use that.

But as said, comparing LTO bytecode is of questionable value and comparing the
binaries doesn't work...

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #3 from Richard Biener  ---
Not yet fixed.  As we compare LTO bytecode but that includes the .opts section
we now have -f[no-]checking there...  We can't remove it there since we of
course want to have different settings at link-time.  A custom do-compare
script like bootstrap-debug.mk provides might be a workaround for this
particular
issue.

Maybe time to finally not compare LTO bytecode (but then we need to compare
binaries which we don't do - but we could now that we share the checksums).

OTOH stage2 and stage3 cc1 even differ in the size of the .text section...

So we have "real" bugs to fix here as well it seems ;)

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

--- Comment #2 from Richard Biener  ---
Author: rguenth
Date: Mon Apr 30 08:18:03 2018
New Revision: 259755

URL: https://gcc.gnu.org/viewcvs?rev=259755=gcc=rev
Log:
2018-04-30  Richard Biener  

PR bootstrap/85571
* Makefile.tpl (STAGE3_CFLAGS): Use -fchecking=1.
(STAGE3_TFLAGS): Likewise.
(STAGEtrain_CFLAGS): Filter out -fchecking=1.
(STAGEtrain_TFLAGS): Likewise.
* Makefile.in: Regenerate.

* dwarf2out.c (gen_producer_string): Ignore -fchecking[=].

Modified:
trunk/ChangeLog
trunk/Makefile.in
trunk/Makefile.tpl
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[Bug bootstrap/85571] [9 Regression] non-bootstrap-debug miscompare with trunk

2018-04-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85571

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-04-30
  Component|lto |bootstrap
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
Summary|ltobootstrap miscompare |[9 Regression]
   |with trunk and x86-64   |non-bootstrap-debug
   ||miscompare with trunk
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Confirmed.  Happens as soon as we compare debug info thus any build-config
besides bootstrap-debug is affected.  Caused by

2018-04-26  Richard Biener  

* Makefile.tpl (STAGE1_TFLAGS): Add -fno-checking.
(STAGE2_CFLAGS): Likewise.
(STAGE2_TFLAGS): Likewise.
(STAGE3_CFLAGS): Add -fchecking.
(STAGE3_TFLAGS): Likewise.
(STAGEtrain_CFLAGS): Filter out -fchecking.
(STAGEtrain_TFLAGS): Likewise.
* Makefile.in: Re-generate.

I'm testing a (first step) fix.