public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/12941] [tree-ssa] builtin-bitops-1.c miscompilation
Date: Fri, 23 Jan 2004 02:19:00 -0000	[thread overview]
Message-ID: <20040123021940.28391.qmail@sources.redhat.com> (raw)
In-Reply-To: <20031107144745.12941.falk@debian.org>


------- Additional Comments From rth at gcc dot gnu dot org  2004-01-23 02:19 -------
This is not loop, but combine.  Its line of reasoning goes

1)   (2 & (1 << (63 - i))) != 0)
2) = (((2 >> (63 - i)) & 1) != 0)
3) = (((2 >> ~i) & 1) != 0)         # From SHIFT_COUNT_TRUNCATED
4) = ~i == 1                        # Since only 2 >> 1 & 1 != 0
5) = i == -2

Of course, I is never negative; the correct result is I == 62.

Clearly the reasoning in step 4 is flawed if SHIFT_COUNT_TRUNCATED is set.
I've not yet located the exact place in combine that makes this leap...



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
            Summary|[tree-ssa] loop             |[tree-ssa] builtin-bitops-
                   |miscompilation              |1.c miscompilation


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


  parent reply	other threads:[~2004-01-23  2:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-07 14:47 [Bug optimization/12941] New: [tree-ssa] loop miscompilation falk at debian dot org
2003-11-07 15:49 ` [Bug optimization/12941] " pinskia at gcc dot gnu dot org
2003-11-07 17:54 ` falk at debian dot org
2003-11-07 17:58 ` pinskia at gcc dot gnu dot org
2003-11-18  5:39 ` pinskia at gcc dot gnu dot org
2003-11-18  9:23 ` falk dot hueffner at student dot uni-tuebingen dot de
2003-11-18  9:35 ` pinskia at gcc dot gnu dot org
2003-12-01  4:38 ` pinskia at gcc dot gnu dot org
2003-12-01 14:22 ` falk at debian dot org
2004-01-23  2:19 ` rth at gcc dot gnu dot org [this message]
2004-01-23 20:27 ` [Bug optimization/12941] [tree-ssa] builtin-bitops-1.c miscompilation cvs-commit at gcc dot gnu dot org
2004-01-23 22:38 ` rth at gcc dot gnu dot org
2004-01-27 13:05 ` cvs-commit at gcc dot gnu dot org
2004-01-30 19:57 ` jbuck at gcc dot gnu dot org
2004-01-30 20:03 ` rth at redhat dot com
2004-01-30 23:25 ` jbuck at gcc dot gnu dot 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=20040123021940.28391.qmail@sources.redhat.com \
    --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).