public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pluto at agmk dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/27417]  New: wrong code or aliasing violation with missed diagnostic?
Date: Thu, 04 May 2006 10:47:00 -0000	[thread overview]
Message-ID: <bug-27417-7667@http.gcc.gnu.org/bugzilla/> (raw)

inline float quickBinaryToFloat( unsigned const& in )
{
        return reinterpret_cast< float const& >( in ) ;
}

float foo( unsigned x )
{
        unsigned y = ( x * 2 ) + 1;
        return quickBinaryToFloat( y );
}


[ wrong-code generated ]

$ i486-gnu-linux-g++ bin2float.cpp -Wall -O2 -c -fomit-frame-pointer -m32

00000000 <foo(unsigned int)>:
   0:   83 ec 10                sub    $0x10,%esp
   3:   d9 44 24 0c             flds   0xc(%esp)
   7:   83 c4 10                add    $0x10,%esp
   a:   c3                      ret

[ correct code generated ]

$ i486-gnu-linux-g++ bin2float.cpp -Wall -O2 -c -fomit-frame-pointer -m32 \
                                   -fno-strict-aliasing

00000000 <foo(unsigned int)>:
   0:   83 ec 10                sub    $0x10,%esp
   3:   8b 44 24 14             mov    0x14(%esp),%eax
   7:   8d 44 00 01             lea    0x1(%eax,%eax,1),%eax
   b:   89 44 24 0c             mov    %eax,0xc(%esp)
   f:   d9 44 24 0c             flds   0xc(%esp)
  13:   83 c4 10                add    $0x10,%esp
  16:   c3                      ret


-- 
           Summary: wrong code or aliasing violation with missed diagnostic?
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


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


             reply	other threads:[~2006-05-04 10:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 10:47 pluto at agmk dot net [this message]
2006-05-04 11:58 ` [Bug other/27417] " rguenth at gcc dot gnu dot org
2006-05-04 12:08 ` pluto at agmk dot net
2006-05-04 14:00 ` rguenth at gcc dot gnu dot org
2006-05-05 15:10 ` pluto at agmk dot net

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-27417-7667@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).