public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/65802] [6 Regression] ICE in redirect_eh_edge_1, at tree-eh.c:2335
Date: Sun, 19 Apr 2015 21:30:00 -0000	[thread overview]
Message-ID: <bug-65802-4-mvZBrsbfst@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65802-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from vries at gcc dot gnu.org ---
The assert triggering is:
...
(gdb) 
#5  0x00000000011325fe in redirect_eh_edge_1 (edge_in=0x7ffff64af4d0,
new_bb=0x7ffff64ae4e0, change_region=true) at src/gcc/tree-eh.c:2335
2335      gcc_assert (lookup_stmt_eh_lp (throw_stmt) == old_lp_nr);
...

Indeed the comparison fails:
...
(gdb) p old_lp_nr
$1 = 1
(gdb) p lookup_stmt_eh_lp (throw_stmt)
$2 = 0
...

And lookup_stmt_eh_lp (throw_stmt) is 0, because throw_stmt is NULL, which
presumably is not intended to be NULL here:
...
(gdb) p throw_stmt
$3 = (gimple) 0x0
...

throw_stmt is initialized here:
...
2334      throw_stmt = last_stmt (edge_in->src);
...

In fact edge_in->src is an empty bb:
...
(gdb) call debug_bb (edge_in->src)
;; basic block 15, loop depth 0, count 0, freq 0, maybe hot
;;  prev block 14, next block 3, flags: (NEW)
;;  pred:       14 (FALLTHRU)
;;  succ:       7 (EH)
;;              3 (FALLTHRU)
...

Before pass_lower_vaarg, we have this definition in bb2 definining for _6:
...
;;   basic block 2, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 0, next block 3, flags: (NEW, REACHABLE)
;;    pred:       ENTRY (FALLTHRU)
  [LP 1] # .MEM_5 = VDEF <.MEM_4(D)>
  # USE = anything
  # CLB = anything
  _6 = VA_ARG (&cD.2333, 0B);
;;    succ:       7 (EH)
;;                3 (FALLTHRU)
...

After pass_lower_vaarg, it's spread over several basic blocks:
...
;;   basic block 2, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 0, next block 11, flags: (NEW, REACHABLE)
;;    pred:       ENTRY (FALLTHRU)
;;    succ:       11 [100.0%]  (FALLTHRU)

;;   basic block 11, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 2, next block 12, flags: (NEW)
;;    pred:       2 [100.0%]  (FALLTHRU)
  # VUSE <.MEM_4(D)>
  _22 = cD.2333.gp_offsetD.5;
  if (_22 >= 48)
    goto <bb 13> (<L6>);
  else
    goto <bb 12> (<L5>);
;;    succ:       13 (TRUE_VALUE)
;;                12 (FALSE_VALUE)

;;   basic block 12, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 11, next block 13, flags: (NEW)
;;    pred:       11 (FALSE_VALUE)
<L5>:
  # VUSE <.MEM_4(D)>
  _23 = cD.2333.reg_save_areaD.8;
  # VUSE <.MEM_4(D)>
  _24 = cD.2333.gp_offsetD.5;
  _25 = (sizetype) _24;
  addr.1_26 = _23 + _25;
  # VUSE <.MEM_4(D)>
  _27 = cD.2333.gp_offsetD.5;
  _28 = _27 + 8;
  # .MEM_29 = VDEF <.MEM_4(D)>
  cD.2333.gp_offsetD.5 = _28;
  goto <bb 14> (<L7>);
;;    succ:       14 (FALLTHRU)

;;   basic block 13, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 12, next block 14, flags: (NEW)
;;    pred:       11 (TRUE_VALUE)
<L6>:
  # VUSE <.MEM_4(D)>
  _30 = cD.2333.overflow_arg_areaD.7;
  addr.1_31 = _30;
  _32 = _30 + 8;
  # .MEM_33 = VDEF <.MEM_4(D)>
  cD.2333.overflow_arg_areaD.7 = _32;
;;    succ:       14 (FALLTHRU)

;;   basic block 14, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 13, next block 15, flags: (NEW)
;;    pred:       12 (FALLTHRU)
;;                13 (FALLTHRU)
  # .MEM_20 = PHI <.MEM_29(12), .MEM_33(13)>
  # addr.1_21 = PHI <addr.1_26(12), addr.1_31(13)>
<L7>:
  # VUSE <.MEM_20>
  _6 = MEM[(intD.9 * * {ref-all})addr.1_21];
;;    succ:       15 (FALLTHRU)

;;   basic block 15, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 14, next block 3, flags: (NEW)
;;    pred:       14 (FALLTHRU)
;;    succ:       7 (EH)
;;                3 (FALLTHRU)
...

Before the expansion, the ifn_va_arg is the statement that could throw:
...
(gdb) call debug_bb_n (2)
;; basic block 2, loop depth 0, count 0, freq 0, maybe hot
;;  prev block 0, next block 3, flags: (NEW, REACHABLE)
;;  pred:       ENTRY (FALLTHRU)
[LP 1] # .MEM_5 = VDEF <.MEM_4(D)>
# USE = anything 
# CLB = anything 
_6 = VA_ARG (&cD.2333, 0B);
;;  succ:       7 (EH)
;;              3 (FALLTHRU)

$1 = (basic_block_def *) 0x7ffff64ae270
(gdb) call stmt_could_throw_p ( last_stmt ($1 ) )
$3 = true
...

But the last statement before bb15 cannot throw:
...
(gdb) call debug_bb_n (14)
;; basic block 14, loop depth 0, count 0, freq 0, maybe hot
;;  prev block 13, next block 15, flags: (NEW)
;;  pred:       12 (FALLTHRU)
;;              13 (FALLTHRU)
# .MEM_20 = PHI <.MEM_29(12), .MEM_33(13)>
# addr.1_21 = PHI <addr.1_26(12), addr.1_31(13)>
<L7>:
# VUSE <.MEM_20>
_6 = MEM[(intD.9 * * {ref-all})addr.1_21];
;;  succ:       15 (FALLTHRU)

$4 = (basic_block_def *) 0x7ffff64aea90
(gdb) call stmt_could_throw_p ( last_stmt ($4 ) )
$5 = false
...

So it does not seem to be just a question of removing the last empty bb.


  parent reply	other threads:[~2015-04-19 21:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-65802-4@http.gcc.gnu.org/bugzilla/>
2015-04-19  8:59 ` vries at gcc dot gnu.org
2015-04-19 17:42 ` vries at gcc dot gnu.org
2015-04-19 21:30 ` vries at gcc dot gnu.org [this message]
2015-04-19 21:37 ` vries at gcc dot gnu.org
2015-04-20  7:23 ` vries at gcc dot gnu.org
2015-04-20  8:24 ` rguenth at gcc dot gnu.org
2015-04-20  8:42 ` vries at gcc dot gnu.org
2015-04-21  8:43 ` vries at gcc dot gnu.org
2015-04-21  8:46 ` vries at gcc dot gnu.org
2015-04-24 14:19 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65802-4-mvZBrsbfst@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).