public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/42512] [4.5 Regression] integer wrong code bug with loop
Date: Fri, 08 Jan 2010 15:00:00 -0000	[thread overview]
Message-ID: <20100108150044.8848.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42512-12544@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-01-08 15:00 -------
Hm, actually what is wrong is the evolution of l_2_18:

  (scalar = l_2_18)
  (scalar_evolution = {255, +, 0x0ffffffff}_1))

that of l_2_10 is correct:

  (scalar = l_2_10)
  (scalar_evolution = (unsigned int) {254, +, 255}_1))

<bb 3>:
  # l_2_18 = PHI <l_2_10(4), 0x0ffffffff(2)>
  # prephitmp.10_25 = PHI <g_3.2_7(4), pretmp.9_24(2)>
  # ivtmp.19_37 = PHI <ivtmp.19_29(4), 255(2)>
  D.1960_3 = (short unsigned int) l_2_18;
  g_3.1_5 = (short unsigned int) prephitmp.10_25;
  D.1963_6 = D.1960_3 | g_3.1_5;
  g_3.2_7 = (short int) D.1963_6;
  g_3_lsm.18_11 = g_3.2_7;
  D.1965_8 = (unsigned char) l_2_18;
  D.1966_9 = D.1965_8 + 255;
  l_2_10 = (unsigned int) D.1966_9;
  ivtmp.19_29 = ivtmp.19_37 - 1;
  if (ivtmp.19_29 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  goto <bb 3>;


Thus we need to verify we maintain the correct initial condition only?
Like for example with

Index: tree-scalar-evolution.c
===================================================================
--- tree-scalar-evolution.c     (revision 155732)
+++ tree-scalar-evolution.c     (working copy)
@@ -1642,6 +1642,15 @@ interpret_loop_phi (struct loop *loop, g
   init_cond = analyze_initial_condition (loop_phi_node);
   res = analyze_evolution_in_loop (loop_phi_node, init_cond);

+  /* Verify we maintained the correct initial condition throughout
+     possible conversions in the SSA chain.  */
+  if (res != chrec_dont_know)
+    {
+      tree new_init = initial_condition (res);
+      if (!operand_equal_p (init_cond, new_init, 0))
+       return chrec_dont_know;
+    }
+
   return res;
 }


Maybe too strict in case the returned chrec is wrapped in a conversion
operation itself (no idea if that ever happens - at least initial_condition
doesn't seem to deal with that during recursion either).

I'm going to test that patch.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-12-26 20:00:19         |2010-01-08 15:00:44
               date|                            |


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


  parent reply	other threads:[~2010-01-08 15:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-26 19:27 [Bug c/42512] New: possible integer wrong code bug regehr at cs dot utah dot edu
2009-12-26 20:00 ` [Bug middle-end/42512] [4.5 Regression] integer wrong code bug with loop jakub at gcc dot gnu dot org
2009-12-26 22:13 ` hjl dot tools at gmail dot com
2009-12-26 22:16 ` hjl dot tools at gmail dot com
2009-12-27 14:43 ` ebotcazou at gcc dot gnu dot org
2010-01-08 14:07 ` rguenth at gcc dot gnu dot org
2010-01-08 15:00 ` rguenth at gcc dot gnu dot org [this message]
2010-01-08 16:20 ` spop at gcc dot gnu dot org
2010-01-08 16:53 ` rguenth at gcc dot gnu dot org
2010-01-08 17:07 ` rguenth at gcc dot gnu dot org
2010-01-08 17:21 ` rguenth at gcc dot gnu dot org
2010-01-08 17:55   ` Sebastian Pop
2010-01-08 17:55 ` sebpop at gmail dot com
2010-01-09 12:04 ` rguenth at gcc dot gnu dot org
2010-01-09 12:04 ` rguenth at gcc dot gnu dot org
2010-02-07  4:49 ` hjl at gcc dot gnu dot org
     [not found] <bug-42512-4@http.gcc.gnu.org/bugzilla/>
2022-10-25 11:40 ` cvs-commit 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=20100108150044.8848.qmail@sourceware.org \
    --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).