[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-19 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #13 from Jan Hubicka  ---
Author: hubicka
Date: Wed Jul 19 21:06:55 2017
New Revision: 250370

URL: https://gcc.gnu.org/viewcvs?rev=250370&root=gcc&view=rev
Log:
PR middle-end/81331
* except.c (execute): Fix ordering issue.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/except.c

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-19 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #12 from Jan Hubicka  ---
Author: hubicka
Date: Wed Jul 19 18:08:07 2017
New Revision: 250358

URL: https://gcc.gnu.org/viewcvs?rev=250358&root=gcc&view=rev
Log:

PR middle-end/81331
* except.c (maybe_add_nop_after_section_switch): New function.
(execute): Use it.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/except.c

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-17 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-15 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #11 from Jan Hubicka  ---
Created attachment 41766
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41766&action=edit
Patch I am testing

Hi,
this patch adds sanity check that turns the nasty wrong code issue into ICE and
a hack to bb-reorder that should prevent it from placing EH landing pads very
first.  I am not quite sure this is robust enough, but can't think of better
fix. We may end up outputting extra NOP in case we fail to find right order.

Honza

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-15 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

Eric Botcazou  changed:

   What|Removed |Added

 CC||ebotcazou at gcc dot gnu.org

--- Comment #10 from Eric Botcazou  ---
This also happens for a couple of ACATS tests on Linux.

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-15 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #9 from Jan Hubicka  ---
OK, found it.  The problem is in EH table entries like:

.uleb128 .LEHB8-.LCOLDB1
.uleb128 .LEHE8-.LEHB8
.uleb128 .L16-.LCOLDB1
.uleb128 0x1

Now the third entry is landing pad.  If L16 happens to be the first label of
cold section then .L16-.LCOLDB1 == 0. In this case it is misinterpreted by the
runtime as no landing pad and EH is not delivered.

I suppose we can always arrange cold sections to not start by EH receiver...

Honza

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

Jan Hubicka  changed:

   What|Removed |Added

 CC||ian at airs dot com,
   ||jason at redhat dot com,
   ||rth at gcc dot gnu.org

--- Comment #8 from Jan Hubicka  ---
Richard, Iant, Jason,
it would be great if at least one of you told me what is wrong with Eh delivery
here ;)

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #7 from Jan Hubicka  ---
Created attachment 41706
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41706&action=edit
bbpart dump (good version)

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #6 from Jan Hubicka  ---
Created attachment 41705
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41705&action=edit
bbpart dump (bad version)

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #5 from Jan Hubicka  ---
Created attachment 41704
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41704&action=edit
Assembly with hacked BB movement (so it passes and is closer to bad.s)

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #4 from Jan Hubicka  ---
Created attachment 41703
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41703&action=edit
broken assembly (generated by revision 250073)

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #3 from Jan Hubicka  ---
Created attachment 41702
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41702&action=edit
Working assembly (without profile sanitization)

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

--- Comment #2 from Jan Hubicka  ---
The wrong code is triggered by partitioning.  The function is somewhat odd by
requiring an EH edge to finish properly while we predict EH edges are unlikely.
This is however partly undone by the hack in bb-reorder that tries to sanitize
profile insanities.   Terminate is called from cxa_throw because of:

  // Some sort of unwinding error.  Note that terminate is a handler.
  __cxa_begin_catch (&header->exc.unwindHeader);
  std::terminate ();

I am not quite sure why unwinding fails. I have tracked down the particular BB
movement that triggers the wrong code.
It is moving bb 23 from cold to hot triggers also conssequently promoting of bb
24 because it is a landing pad that is only reached from bb 23.
Either disabling movement of bb 23 or changing also partition of BB 25 solves
the problem. Perhas cxa_begin_catch and cxa_end_catch should not cross
partitions?

cxa_* code is not very well commented to say at least...

I am attaching good.s that is without problematic parittioning bad.s which is
one triggering failure and hacked.s that is the one with fixed movement of bb
25.  It would be great to know why bad.s fails.

;; basic block 22, loop depth 0, count 0, freq 0, probably never executed
;;  prev block 64, next block 23, flags: (REACHABLE, COLD_PARTITION, RTL,
MODIFIED)
;;  pred:   64 [always]  count:0 (CROSSING)
;; bb 22 artificial_defs: { }
;; bb 22 artificial_uses: { u-1(6){ }u-1(7){ }u-1(16){ }u-1(20){ }}
;; lr  in6 [bp] 7 [sp] 16 [argp] 20 [frame] 177 178 179
;; lr  use   6 [bp] 7 [sp] 16 [argp] 20 [frame] 178 179
;; lr  def   0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [st] 9 [st(1)] 10 [st(2)]
11 [st(3)] 12 [st(4)] 13 [st(5)] 14 [st(6)] 15 [st(7)] 17 [flags] 18 [fpsr] 19
[fpcr] 21 [xmm0] 22 [xmm1] 23 [xmm2] 24 [xmm3] 25 [xmm4] 26 [xmm5] 27 [xmm6] 28
[xmm7] 29 [mm0] 30 [mm1] 31 [mm2] 32 [mm3] 33 [mm4] 34 [mm5] 35 [mm6] 36 [mm7]
37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [xmm8] 46 [xmm9] 47 [xmm10] 48 [xmm11] 49
[xmm12] 50 [xmm13] 51 [xmm14] 52 [xmm15] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59
[] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72
[] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 [] 138 139
;; live  in  6 [bp] 7 [sp] 16 [argp] 20 [frame] 177 178 179
;; live  gen 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 37 [r8] 138 139
;; live  kill17 [flags]
(code_label 466 480 156 22 58 (nil) [1 uses])
(note 156 466 157 22 [bb 22] NOTE_INSN_BASIC_BLOCK)
(insn 157 156 158 22 (set (reg:DI 139 [ MEM[(const struct basic_string *)&str02
+ 8B] ])
(mem/c:DI (plus:DI (reg/f:DI 20 frame)
(const_int -88 [0xffa8])) [0 MEM[(const struct
basic_string *)&str02 + 8B]+0 S8 A64]))
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
81 {*movdi_internal}
 (nil))
(insn 158 157 161 22 (parallel [
(set (reg:DI 138)
(plus:DI (reg:DI 139 [ MEM[(const struct basic_string *)&str02
+ 8B] ])
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
])
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
218 {*adddi_1}
 (expr_list:REG_DEAD (reg:DI 139 [ MEM[(const struct basic_string *)&str02
+ 8B] ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (plus:DI (mem/c:DI (plus:DI (reg/f:DI 20
frame)
(const_int -88 [0xffa8])) [0 MEM[(const
struct basic_string *)&str02 + 8B]+0 S8 A64])
(const_int 1 [0x1]))
(nil)
(insn 161 158 162 22 (set (reg:DI 37 r8)
(const_int 5 [0x5]))
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
81 {*movdi_internal}
 (nil))
(insn 162 161 163 22 (set (reg:DI 2 cx)
(reg:DI 138))
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
81 {*movdi_internal}
 (expr_list:REG_DEAD (reg:DI 138)
(nil)))
(insn 163 162 164 22 (set (reg:DI 1 dx)
(reg/f:DI 178))
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
81 {*movdi_internal}
 (expr_list:REG_EQUAL (plus:DI (reg/f:DI 20 frame)
(const_int -96 [0xffa0]))
(nil)))
(insn 164 163 165 22 (set (reg:DI 4 si)
(const_int 0 [0]))
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
81 {*movdi_internal}
 (nil))
(insn 165 164 166 22 (set (reg:DI 5 di)
(reg/f:DI 179))
"/home/jan/trunk/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/insert/char/1.cc":67
81 {*movdi_internal}
 (expr_list:REG_EQUAL (plus:DI (reg/f:DI 20 frame)
(const_int -64 [0xffc0]))
(nil)))
(call_insn 166 165 465 22 (set (reg:DI 0 ax)
(call (mem:QI (symbol_ref:DI
("_ZNSt7__cxx1112basic_

[Bug regression/81331] [8 Regression] FAIL: 21_strings/basic_string/modifiers/insert/char/1.cc execution test

2017-07-07 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81331

Rainer Orth  changed:

   What|Removed |Added

 Target|x86_64-pc-linux-gnu |x86_64-pc-linux-gnu,
   ||i386-pc-solaris2.12
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-07-07
 CC||ro at gcc dot gnu.org
   Target Milestone|--- |8.0
 Ever confirmed|0   |1

--- Comment #1 from Rainer Orth  ---
I already see it at r249926 on i386-pc-solaris2.12 (32-bit only), so it
appeared
between r249882 and r249926.

  Rainer