public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eraman at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/57393] [4.9 Regression] error: definition in block 4 follows the use / internal compiler error: verify_ssa failed
Date: Fri, 23 Aug 2013 01:08:00 -0000	[thread overview]
Message-ID: <bug-57393-4-Qp2hjrK3O4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57393-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57393

--- Comment #22 from Easwaran Raman <eraman at google dot com> ---
(In reply to Marek Polacek from comment #20)
> Yes, the patch maybe fixes the debuginfo issue, but there's something else
> that is wrong.  E.g., on the testcase from PR58018, we have in
> reassociate_bb *after*
> (and that is important) optimize_range_tests this:
> 
> <bb 7>:
> [...]
> e.1_16 = _14 & e.0_15;
> _17 = f_12 >= 0;
> _18 = (int) _17;
> e.1_19 = e.1_16 & _18;
> _20 = f_12 > 0;
> _23 = f_12 > 0;
> _24 = (int) _23;
> _21 = (int) _20;
> e.1_22 = e.1_19 & _21;
> [...]
> 
> Now, in reassociate_bb, we go over the stmts, from the last stmt to the
> first stmt in the bb.  For the appropriate stmts, we call rewrite_expr_tree
> to rewrite the linearized statements according to the operand_entry_t ops
> vector, in this case we call it on
>   e.1_22 = e.1_19 & _21;
> and the vector ops contains
>   Op 0 -> rank: 589826, tree: _14
>   Op 1 -> rank: 3, tree: _24
>   Op 2 -> rank: 1, tree: e.0_15
> 
> In rewrite_expr_tree, we recursively call this function on e.1_19, whose
> SSA_NAME_DEF_STMT is
>   e.1_19 = e.1_16 & _18;
> This stmt is then transformed into
>   e.1_19 = _24 & e.0_15;
> 
> But, at the point where e.1_19 is defined, the _24 isn't defined yet!
> 
> So, it seems, ensure_ops_are_available should handle a situation like this. 
> However, it doesn't: perhaps the issue is that find_insert_point won't find
> the right insert point (the stmt is e.1_19 = e.1_16 & _18;, the dep_stmt is
> _24 = (int) _23;), in there we have:
> 
>   if (gimple_uid (insert_stmt) == gimple_uid (dep_stmt)
>       && gimple_bb (insert_stmt) == gimple_bb (dep_stmt)
>       && insert_stmt != dep_stmt)
>     insert_stmt = appears_later_in_bb (insert_stmt, dep_stmt);
>   else if (not_dominated_by (insert_stmt, dep_stmt))
>     insert_stmt = dep_stmt;
>   return insert_stmt;
> 
> Neither of these condition holds; gimple_uid of the dep_stmt is 0 and of
> insert_stmt it is 16.  Thus, find_insert_point returns e.1_19 = e.1_16 &
> _18;.  That's wrong, I suppose.
> Maybe the issue is that if the two stms are in the same bb, we just look at
> their UIDs and based on that we find out the dependency, but the new stms
> coming  from optimize_range_tests don't have gimple UIDs set, thus this
> can't work.
> Likely I'm wrong, would appreciate if someone could shed some light on this.
> 
> Looking into it more...

The problem with this test case is that there is a statement with uid 0 that is
being compared. The assumption was every stmt will have a UID in a
monotonically non-decreasing order. This is broken here because
force_gimple_operand_gsi generates new stmts that don't have a UID. The
proposed patch generates UIDs for these newly generated statements but I think
this is a bit ugly and fragile now.


  parent reply	other threads:[~2013-08-23  1:08 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-57393-4@http.gcc.gnu.org/bugzilla/>
2013-05-24  9:14 ` rguenth at gcc dot gnu.org
2013-05-24  9:35 ` izamyatin at gmail dot com
2013-05-29  5:07 ` Joost.VandeVondele at mat dot ethz.ch
2013-05-29  5:09 ` Joost.VandeVondele at mat dot ethz.ch
2013-05-29  8:31 ` rguenth at gcc dot gnu.org
2013-06-03 11:12 ` Joost.VandeVondele at mat dot ethz.ch
2013-07-02  0:29 ` d.g.gorbachev at gmail dot com
2013-07-12 10:33 ` dcb314 at hotmail dot com
2013-07-24 10:10 ` mpolacek at gcc dot gnu.org
2013-08-12  5:41 ` mpolacek at gcc dot gnu.org
2013-08-20  9:25 ` mpolacek at gcc dot gnu.org
2013-08-20  9:30 ` mpolacek at gcc dot gnu.org
2013-08-20 10:15 ` Joost.VandeVondele at mat dot ethz.ch
2013-08-20 11:13 ` dcb314 at hotmail dot com
2013-08-20 11:41 ` mpolacek at gcc dot gnu.org
2013-08-20 11:49 ` jakub at gcc dot gnu.org
2013-08-20 11:55 ` mpolacek at gcc dot gnu.org
2013-08-20 17:15 ` eraman at google dot com
2013-08-20 18:40 ` Joost.VandeVondele at mat dot ethz.ch
2013-08-21  8:49 ` mpolacek at gcc dot gnu.org
2013-08-23  1:03 ` eraman at google dot com
2013-08-23  1:08 ` eraman at google dot com [this message]
2013-08-27  7:16 ` Joost.VandeVondele at mat dot ethz.ch
2013-08-27  9:09 ` Joost.VandeVondele at mat dot ethz.ch
2013-08-27  9:21 ` jakub at gcc dot gnu.org
2013-08-28 17:50 ` eraman at google dot com
2013-08-29  9:18 ` Joost.VandeVondele at mat dot ethz.ch
2013-08-30  0:21 ` eraman at google dot com
2013-08-30  6:46 ` Joost.VandeVondele at mat dot ethz.ch
2013-08-30  7:56 ` rguenth at gcc dot gnu.org
2013-08-30  7:58 ` rguenth at gcc dot gnu.org
2013-09-10 17:33 ` regehr at cs dot utah.edu
2013-09-10 18:30 ` jakub at gcc dot gnu.org
2013-09-11 19:32 ` su at cs dot ucdavis.edu
2013-09-23  9:08 ` rguenth at gcc dot gnu.org
2013-09-23  9:08 ` rguenth at gcc dot gnu.org
2013-09-25  0:58 ` su at cs dot ucdavis.edu
2013-10-30 12:24 ` rguenth at gcc dot gnu.org
2013-10-30 12:30 ` Joost.VandeVondele at mat dot ethz.ch
2013-10-30 12:33 ` jakub at gcc dot gnu.org
2013-11-27 23:43 ` jakub at gcc dot gnu.org
2013-11-27 23:50 ` jakub at gcc dot gnu.org
2014-02-16 13:18 ` jackie.rosen at hushmail dot com

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-57393-4-Qp2hjrK3O4@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).