public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xinliangli at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/47812] [x32] __builtin_strlen is miscompiled at -O2
Date: Sat, 19 Feb 2011 07:47:00 -0000	[thread overview]
Message-ID: <bug-47812-4-EZLExOs22X@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47812-4@http.gcc.gnu.org/bugzilla/>

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

davidxl <xinliangli at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xinliangli at gmail dot com

--- Comment #1 from davidxl <xinliangli at gmail dot com> 2011-02-19 07:05:47 UTC ---

There is a bug in the expand phase.   Pseudo reg 59 is not initialized which
leads to an initialization to 0 by the init-reg pass. combine pass then happily
simply the comparison result with 1 which is returned.


The bad case with x32 where reg:SI 64 is initialized instead of 59:

insn 25 24 0 (parallel [
            (set (reg:DI 64)
                (minus:DI (reg:DI 64)
                    (reg:DI 62)))
            (clobber (reg:CC 17 flags))
        ]) pr47812.c:5 -1
     (nil))

;; return D.2771_2;

(insn 29 25 30 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 59 [ D.2772 ])
            (const_int 3 [0x3]))) pr47812.c:5 -1
     (nil))

The good case x86_64:

(insn 24 23 0 (parallel [
            (set (reg:DI 59 [ D.2772 ])
                (minus:DI (reg:DI 59 [ D.2772 ])
                    (reg:DI 62)))
            (clobber (reg:CC 17 flags))
        ]) pr47812.c:5 -1
     (nil))

;; return D.2771_2;

(insn 26 24 27 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:DI 59 [ D.2772 ])
            (const_int 3 [0x3]))) pr47812.c:5 -1
     (nil))


David


  parent reply	other threads:[~2011-02-19  7:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-19  0:56 [Bug target/47812] New: " hjl.tools at gmail dot com
2011-02-19  7:47 ` [Bug target/47812] " xinliangli at gmail dot com
2011-02-19  7:47 ` xinliangli at gmail dot com [this message]
2011-02-19 14:53 ` hjl.tools at gmail 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-47812-4-EZLExOs22X@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).