[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #8 from Jakub Jelinek  ---
Ah, this is a dup of PR68404, at least the
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68404#c19 fix seems to fix the
issue (just tested the assembly, haven't tried profiledbootstrap yet).

*** This bug has been marked as a duplicate of bug 68404 ***

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

--- Comment #7 from Jakub Jelinek  ---
The ICE is around
140   ok = (cached_reg_save_code[reg][mode] != -1
141 && cached_reg_restore_code[reg][mode] != -1);
   0x10e84a24 :   stw
r10,1792(r6)
   0x10e84a28 :   stw
r10,-21428(r8)
   0x10e84a2c :   b  
0x10e849e4 
   0x10e84a30 :   addis   r9,r9,1
=> 0x10e84a34 :   lwz
r9,-21428(r9)
   0x10e84a38 :   cmpwi   r9,-1
   0x10e84a3c :   beq-   
0x10e849c8 
   0x10e84a40 :   addis   r3,r2,1
   0x10e84a44 :   ld 
r3,-29144(r3)
   0x10e84a48 :   bl 
0x109149d0 
   0x10e84a4c :   nop
   0x10e84a50 :   addis   r3,r2,1
End of assembler dump.
(gdb) p/x $r9
$2 = 0x1dd90
(gdb) p this_target_reload
$3 = (target_reload *) 0x117060d8 
(gdb) p &this_target_reload
$4 = (target_reload **) 0x11586948 

The addis r9,r9,1;lwz r9,-21428(r9) is in *.final:
(insn:TI 366 165 169 (set (reg:DI 9 9)
(unspec:DI [
(zero_extend:DI (mem:SI (plus:DI (plus:DI (reg/f:DI 9 9
[orig:199 _98 ] [199])
(const_int 65536 [0x1]))
(const_int -21428 [0xac4c])) [79
MEM[(struct target_reload *)_98 + 44108B]+0 S4 A32]))
] UNSPEC_FUSION_GPR)) ../../gcc/caller-save.c:141 858
{fusion_gpr_load_di}
 (nil))
(insn 169 366 170 (set (reg:CC 68 0 [270])
(compare:CC (reg:SI 9 9 [orig:268 MEM[(struct target_reload *)_98 +
44108B] ] [268])
(const_int -1 [0x]))) ../../gcc/caller-save.c:141
720 {*cmpsi_signed}
 (expr_list:REG_DEAD (reg:SI 9 9 [orig:268 MEM[(struct target_reload *)_98
+ 44108B] ] [268])
(nil)))
but that assumes that r9 contains at that point probably this_target_reload
value, i.e. should be 0x117060d8.
In the code that branches to this spot we have right after reload:
(insn 146 141 144 14 (set (reg/f:DI 9 9 [orig:258 this_target_reload ] [258])
(mem/f/c:DI (reg/f:DI 28 28 [299]) [80 this_target_reload+0 S8 A64]))
550 {*movdi_internal64}
 (expr_list:REG_EQUIV (mem/f/c:DI (reg/f:DI 28 28 [299]) [80
this_target_reload+0 S8 A64])
(expr_list:REG_EQUAL (mem/f/c:DI (symbol_ref:DI ("this_target_reload")
[flags 0xc0]  ) [80 this
(nil
...
(insn 147 144 148 14 (set (reg/f:DI 9 9 [orig:199 _98 ] [199])
(plus:DI (reg/f:DI 9 9 [orig:258 this_target_reload ] [258])
(reg:DI 30 30 [orig:196 _89 ] [196]))) 81 {*adddi3}
 (nil))
(insn 148 147 150 14 (set (reg:SI 10 10 [orig:259 MEM[(struct target_reload
*)_98 + 1792B] ] [259])
(mem:SI (plus:DI (reg/f:DI 9 9 [orig:199 _98 ] [199])
(const_int 1792 [0x700])) [79 MEM[(struct target_reload *)_98 +
1792B]+0 S4 A32])) ../../gcc/caller-save.c:141 438 {*movsi_internal
 (expr_list:REG_EQUIV (mem:SI (plus:DI (reg/f:DI 9 9 [orig:199 _98 ] [199])
(const_int 1792 [0x700])) [79 MEM[(struct target_reload *)_98 +
1792B]+0 S4 A32])
(nil)))
(insn 150 148 151 14 (set (reg:CC 75 7 [261])
(compare:CC (reg:SI 10 10 [orig:259 MEM[(struct target_reload *)_98 +
1792B] ] [259])
(const_int -1 [0x]))) ../../gcc/caller-save.c:141
720 {*cmpsi_signed}
 (nil))
(jump_insn 151 150 171 14 (set (pc)
(if_then_else (ne (reg:CC 75 7 [261])
(const_int 0 [0]))
(label_ref 164)
(pc))) ../../gcc/caller-save.c:141 756 {*rs6000.md:11629}
 (int_list:REG_BR_PROB 3226 (nil))
 -> 164)
but in *.final that doesn't set reg 9 anymore:
(insn 146 138 139 (set (reg/f:DI 8 8 [orig:258 this_target_reload ] [258])
(mem/f/c:DI (reg/f:DI 28 28 [299]) [80 this_target_reload+0 S8 A64]))
550 {*movdi_internal64}
 (expr_list:REG_EQUIV (mem/f/c:DI (reg/f:DI 28 28 [299]) [80
this_target_reload+0 S8 A64])
(expr_list:REG_EQUAL (mem/f/c:DI (symbol_ref:DI ("this_target_reload")
[flags 0xc0]  ) [80 this
(nil
...
(insn 147 141 144 (set (reg/f:DI 3 3 [orig:199 _98 ] [199])
(plus:DI (reg/f:DI 8 8 [orig:258 this_target_reload ] [258])
(reg:DI 30 30 [orig:196 _89 ] [196]))) 81 {*adddi3}
 (expr_list:REG_DEAD (reg/f:DI 8 8 [orig:258 this_target_reload ] [258])
(nil)))
(insn:TI 144 147 148 (set (mem:SI (plus:DI (reg:DI 10 10 [254])
(const_int 12 [0xc])) [4
this_target_reload.31_26->x_cached_reg_restore_code S4 A32])
(reg:SI 6 6 [orig:301 restinsn.38_27->D.43974.u.fld[5].rt_int ] [301]))
../../gcc/caller-save.c:134 438 {*movsi_internal1}
 (expr_list:REG_DEAD (reg:DI 10 10 [254])
(expr_list:REG_DEAD (reg:SI 6 6 [orig:301
restinsn.38_27->D.43974.u.fld[5].rt_int ] [301])
(nil
(insn 148 144 150 (set (reg:DI 7 7)
(zero_extend:DI (mem:SI (plus:DI (reg/f:DI 3 3 [orig:199 _98 ] [199])
(const_int 1792 [0x700])) [79 MEM[(struct target_reload
*)_98 + 1792B]+0 S4 A32]))) ../../gcc

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-02-09
 Ever confirmed|0   |1

--- Comment #6 from Jakub Jelinek  ---
Steps to reproduce on non-powerpc host (no need for ppc64 binutils):
../configure --target powerpc64-linux --enable-languages=c,c++
--disable-bootstrap
make -j16
Ctrl^C it early, after it configures stuff in gcc/ subdir and starts building
there
copy over the attached auto-host.h into gcc/ subdir
cd gcc
touch auto-host.h
make -j16 cc1 cc1plus
copy over the attached caller-save.{ii,gcda} into a new subdirectory
/cc1plus -fpreprocessed caller-save.ii -msecure-plt -quiet -dumpbase
caller-save.ii -auxbase-strip caller-save.s -g -O2 -version -fno-PIE
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -fprofile-use -o
caller-save.s
This generates (besides debug info) the same assembly as the one in native
profiledbootstrap that ICEs on the 
typedef float TFtype __attribute__ ((mode (TF)));
typedef _Complex float TCtype __attribute__ ((mode (TC)));
TCtype
__multc3 (TFtype a, TFtype b, TFtype c, TFtype d)
{
  TFtype ac, bd, ad, bc, x, y;
  TCtype res;

  ac = a * c;
  bd = b * d;
  ad = a * d;
  bc = b * c;

  __asm__ ("" : "=m"(ac) : "m"(ac));
  __asm__ ("" : "=m"(bd) : "m"(bd));
  __asm__ ("" : "=m"(ad) : "m"(ad));
  __asm__ ("" : "=m"(bc) : "m"(bc));

  x = ac - bd;
  y = ad + bc;

  if (__builtin_expect ((x) != (x), 0) && __builtin_expect ((y) != (y), 0))
{

  _Bool recalc = 0;
  if (__builtin_expect (!__builtin_expect ((a) != (a), 0) &
!__builtin_expect (!__builtin_expect (((a) - (a)) != ((a) - (a)), 0), 1), 0) ||
__builtin_expect (!__builtin_expect ((b) != (b), 0) & !__builtin_expect
(!__builtin_expect (((b) - (b)) != ((b) - (b)), 0), 1), 0))
 {


   a = __builtin_copysignl (__builtin_expect (!__builtin_expect ((a) != (a), 0)
& !__builtin_expect (!__builtin_expect (((a) - (a)) != ((a) - (a)), 0), 1), 0)
? 1 : 0, a);
   b = __builtin_copysignl (__builtin_expect (!__builtin_expect ((b) != (b), 0)
& !__builtin_expect (!__builtin_expect (((b) - (b)) != ((b) - (b)), 0), 1), 0)
? 1 : 0, b);
   if (__builtin_expect ((c) != (c), 0)) c = __builtin_copysignl (0, c);
   if (__builtin_expect ((d) != (d), 0)) d = __builtin_copysignl (0, d);
  recalc = 1;
 }
 if (__builtin_expect (!__builtin_expect ((c) != (c), 0) &
!__builtin_expect (!__builtin_expect (((c) - (c)) != ((c) - (c)), 0), 1), 0) ||
__builtin_expect (!__builtin_expect ((d) != (d), 0) & !__builtin_expect
(!__builtin_expect (((d) - (d)) != ((d) - (d)), 0), 1), 0))
 {


   c = __builtin_copysignl (__builtin_expect (!__builtin_expect ((c) != (c), 0)
& !__builtin_expect (!__builtin_expect (((c) - (c)) != ((c) - (c)), 0), 1), 0)
? 1 : 0, c);
   d = __builtin_copysignl (__builtin_expect (!__builtin_expect ((d) != (d), 0)
& !__builtin_expect (!__builtin_expect (((d) - (d)) != ((d) - (d)), 0), 1), 0)
? 1 : 0, d);
   if (__builtin_expect ((a) != (a), 0)) a = __builtin_copysignl (0, a);
   if (__builtin_expect ((b) != (b), 0)) b = __builtin_copysignl (0, b);
   recalc = 1;
 }
 if (!recalc
   && (__builtin_expect (!__builtin_expect ((ac) != (ac), 0) &
!__builtin_expect (!__builtin_expect (((ac) - (ac)) != ((ac) - (ac)), 0), 1),
0) || __builtin_expect (!__builtin_expect ((bd) != (bd), 0) & !__builtin_expect
(!__builtin_expect (((bd) - (bd)) != ((bd) - (bd)), 0), 1), 0)
   || __builtin_expect (!__builtin_expect ((ad) != (ad), 0) &
!__builtin_expect (!__builtin_expect (((ad) - (ad)) != ((ad) - (ad)), 0), 1),
0) || __builtin_expect (!__builtin_expect ((bc) != (bc), 0) & !__builtin_expect
(!__builtin_expect (((bc) - (bc)) != ((bc) - (bc)), 0), 1), 0)))
 {

   if (__builtin_expect ((a) != (a), 0)) a = __builtin_copysignl (0, a);
   if (__builtin_expect ((b) != (b), 0)) b = __builtin_copysignl (0, b);
   if (__builtin_expect ((c) != (c), 0)) c = __builtin_copysignl (0, c);
   if (__builtin_expect ((d) != (d), 0)) d = __builtin_copysignl (0, d);
   recalc = 1;
 }
  if (recalc)
 {
   x = __builtin_huge_vall () * (a * c - b * d);
   y = __builtin_huge_vall () * (a * d + b * c);
 }
}

  __real__ res = x;
  __imag__ res = y;
  return res;
}

testcase.

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

--- Comment #5 from Jakub Jelinek  ---
Created attachment 37647
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37647&action=edit
auto-host.h

auto-host.h

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

--- Comment #4 from Jakub Jelinek  ---
Created attachment 37646
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37646&action=edit
caller-save.gcda

caller-save.gcda

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

--- Comment #3 from Jakub Jelinek  ---
Created attachment 37645
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37645&action=edit
caller-save.ii.bz2

caller-save.ii.bz2

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
That is not that easy, because it is apparently caller-save.c that is
miscompiled with -fprofile-use.
I can attach caller-save.ii and caller-save.gcda.

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

Bernd Schmidt  changed:

   What|Removed |Added

 CC||bernds at gcc dot gnu.org

--- Comment #1 from Bernd Schmidt  ---
Is there a .i file and compiler command line that can reproduce this with a
cross?

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141

2016-02-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69727

Richard Biener  changed:

   What|Removed |Added

   Keywords||build
 Target||powerpc64
   Target Milestone|--- |6.0
Summary|ICE in profiledbootstrap in |[6 Regression] ICE in
   |reg_save_code at|profiledbootstrap in
   |../../gcc/caller-save.c:141 |reg_save_code at
   ||../../gcc/caller-save.c:141