public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "spop at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/64878] [5 Regression] Miscompilation of nntpgrab
Date: Mon, 02 Feb 2015 17:25:00 -0000	[thread overview]
Message-ID: <bug-64878-4-lPteMXkfLH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64878-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Sebastian Pop <spop at gcc dot gnu.org> ---
The problem is in the recursion step of
fsm_find_control_statement_thread_paths:


  for (i = 0; i < gimple_phi_num_args (phi); i++)
    {
      tree arg = gimple_phi_arg_def (phi, i);
      basic_block bbi = gimple_phi_arg_edge (phi, i)->src;
[...]
      if (TREE_CODE (arg) == SSA_NAME)
    {
      vec_safe_push (path, bbi);
      /* Recursively follow SSA_NAMEs looking for a constant definition.  */
      fsm_find_control_statement_thread_paths (arg, visited_phis, path);
      path->pop ();
      continue;
    }

We are not supposed to register a jump-thread following only one of the PHI
arguments, as the other arguments may resolve into a non-constant or a
different constant.

In the current case, we have 

      c = x->c1[x->c2];
      switch (a)
    {
    case 0:
      if (c == ' ')
        x->c2++;
      else if (c == '/')
        {
          a = 4;   // here is the first argument of the phi node
          j = x->c2++;
        }
      else
        a = b;    // recursive call will follow b and resolve into 15

         // here the phi node looks like
         // a0 = phi (4, b)

      break;
    case 1:
      switch (c)
        {
        case '{':
          a = 0;
          b = 15;
          f = f10 ();
          x->c2++;
          break;


  parent reply	other threads:[~2015-02-02 17:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 17:29 [Bug tree-optimization/64878] New: " jakub at gcc dot gnu.org
2015-01-30 17:29 ` [Bug tree-optimization/64878] " jakub at gcc dot gnu.org
2015-01-30 17:30 ` jakub at gcc dot gnu.org
2015-01-30 20:15 ` spop at gcc dot gnu.org
2015-01-30 20:19 ` spop at gcc dot gnu.org
2015-01-30 20:27 ` spop at gcc dot gnu.org
2015-02-02 17:25 ` spop at gcc dot gnu.org [this message]
2015-02-04 17:30 ` spop at gcc dot gnu.org
2015-02-04 17:41 ` jakub at gcc dot gnu.org
2015-02-06 21:08 ` spop at gcc dot gnu.org
2015-02-06 21:16 ` jakub at gcc dot gnu.org
2015-03-05 14:28 ` yroux 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-64878-4-lPteMXkfLH@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).