[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-07 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

Eric Botcazou  changed:

   What|Removed |Added

  Attachment #44066|0   |1
is obsolete||

--- Comment #13 from Eric Botcazou  ---
Created attachment 44081
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44081&action=edit
Tentative fix v2

To be tested.

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #12 from Eric Botcazou  ---
> I wonder why this doesn't seem to happen with DWARF-2 exception handling.

OK, the difference is that dw2_build_landing_pads does:

  lp->landing_pad = gen_label_rtx ();
  emit_label (lp->landing_pad);
  LABEL_PRESERVE_P (lp->landing_pad) = 1;

whereas sjlj_emit_dispatch_table does:

lp->landing_pad = dispatch_label;

In other words, there is a landing pad per post-landing pad with DWARF-2 and a
common landing pad for all post-landing pads with SJLJ so, when you redirect
the edges from post-landing to landing pads, you lose the 1->1 mapping with
SJLJ.

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread xantares09 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #11 from xantares09 at hotmail dot com ---
Oh, ok

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #10 from Eric Botcazou  ---
> Yes, I applied your patch, now the build fails with another error:

This one is yours, you need to compile the 8.1 cross with the 8.1 native.

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread xantares09 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #9 from xantares09 at hotmail dot com ---
Yes, I applied your patch, now the build fails with another error:

gcc -c -I./ -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/adalib/../adainclude
-I/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/adalib -I.
-I/home/xantares/projects/aur-scripts/mingw-w64-gcc/src/gcc/gcc/ada -g -O2 -W
-Wall -gnatpg -gnata -I-
/home/xantares/projects/aur-scripts/mingw-w64-gcc/src/gcc-8.1.0/gcc/ada/fmap.adb
fmap.adb:304:18: "Null_FD" is undefined
gnatmake:
"/home/xantares/projects/aur-scripts/mingw-w64-gcc/src/gcc-8.1.0/gcc/ada/fmap.adb"
compilation error

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #8 from Eric Botcazou  ---
Another (checking) assertion triggers in fix_up_crossing_landing_pad:

rtx_insn *insn = BB_END (e->src);
rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);

gcc_assert (note != NULL);
gcc_checking_assert (INTVAL (XEXP (note, 0)) == old_lp->index);

Since 2 elements of cfun->eh->lp_array can share the same landing pad, you can
have a different REG_EH_REGION note on one of the edges.  I wonder why this
doesn't seem to happen with DWARF-2 exception handling.

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

Eric Botcazou  changed:

   What|Removed |Added

  Attachment #44060|0   |1
is obsolete||
  Attachment #44061|0   |1
is obsolete||

--- Comment #7 from Eric Botcazou  ---
Created attachment 44066
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44066&action=edit
Tentative fix

To be tested.

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #6 from Eric Botcazou  ---
The key point is that several elements of cfun->eh->lp_array can share the same
landing pad:

(gdb) p *cfun->eh->lp_array->m_vecdata[1]
$11 = {next_lp = 0x0, region = 0x7695c898, 
  post_landing_pad = 0x7695df80, landing_pad = 0x76a6b200, index = 1}

(gdb) p *cfun->eh->lp_array->m_vecdata[2]
$12 = {next_lp = 0x0, region = 0x7695c8f0, 
  post_landing_pad = 0x7695de80, landing_pad = 0x76a6b200, index = 2}

(gdb) p *cfun->eh->lp_array->m_vecdata[1]->region
$13 = {outer = 0x0, inner = 0x0, next_peer = 0x0, index = 1, type = ERT_TRY, 
  u = {eh_try = {first_catch = 0x76964398, last_catch = 0x76964398}, 
allowed = {type_list = 0x76964398, label = 0x76964398, 
  filter = 0}, must_not_throw = {failure_decl = 0x76964398, 
  failure_loc = 4137042840}}, landing_pads = 0x769648c0, 
  exc_ptr_reg = 0x76a6a2a0, filter_reg = 0x76a6a150, 
  use_cxa_end_cleanup = false}

(gdb) p *cfun->eh->lp_array->m_vecdata[2]->region
$14 = {outer = 0x0, inner = 0x0, next_peer = 0x7695c898, index = 2, 
  type = ERT_CLEANUP, u = {eh_try = {first_catch = 0x0, last_catch = 0x0}, 
allowed = {type_list = 0x0, label = 0x0, filter = 0}, must_not_throw = {
  failure_decl = 0x0, failure_loc = 0}}, landing_pads = 0x769643c0, 
  exc_ptr_reg = 0x76a6a8e8, filter_reg = 0x0, use_cxa_end_cleanup = false}

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

--- Comment #5 from Eric Botcazou  ---
It's a direct fallout of the fix for PR rtl-optimization/85393:

  FOR_EACH_EDGE (e, ei, bb->preds)
{
  gcc_assert (e->flags & EDGE_EH);
  if (BB_PARTITION (bb) == BB_PARTITION (e->src))
all_diff = false;
  else
all_same = false;
}

which creates incoming edges to landing pads that are not EH edges.

[Bug ada/85638] [8/9 regression] build failure for Ada runtime with SJLJ exceptions on x86

2018-05-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85638

Eric Botcazou  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ebotcazou at gcc dot 
gnu.org

--- Comment #4 from Eric Botcazou  ---
Investigating.