public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/47148] [4.6 Regression] likely wrong code bug
Date: Sat, 01 Jan 2011 20:07:00 -0000	[thread overview]
Message-ID: <bug-47148-4-Ju5ZjHfyCI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47148-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2011.01.01 20:07:21
          Component|c                           |tree-optimization
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|likely wrong code bug       |[4.6 Regression] likely
                   |                            |wrong code bug
   Target Milestone|---                         |4.6.0

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-01 20:07:21 UTC ---
/* PR tree-optimization/47148 */

static inline unsigned
bar (unsigned x, unsigned y)
{
  if (y >= 32)
    return x;
  else
    return x >> y;
}

static unsigned a = 1, b = 1;

static inline void
foo (unsigned char x, unsigned y)
{
  if (!y)
    return;
  unsigned c = (0x7000U / (x - 2)) ^ a;
  unsigned d = bar (a, a);
  b &= ((a - d) && (a - 1)) + c;
}

int
main (void)
{
  foo (1, 1);
  foo (-1, 1);
  if (b && ((unsigned char) -1) == 255)
    __builtin_abort ();
  return 0;
}

Indeed, seems to be caused by partial inlining.  With -fno-partial-inlining it
works fine.


  reply	other threads:[~2011-01-01 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-01 18:40 [Bug c/47148] New: " regehr at cs dot utah.edu
2011-01-01 20:07 ` jakub at gcc dot gnu.org [this message]
2011-01-01 20:17 ` [Bug tree-optimization/47148] [4.6 Regression] " hjl.tools at gmail dot com
2011-01-01 20:54 ` [Bug target/47148] " jakub at gcc dot gnu.org
2011-01-01 21:03 ` hjl.tools at gmail dot com
2011-01-01 21:09 ` jakub at gcc dot gnu.org
2011-01-02 11:29 ` jakub at gcc dot gnu.org
2011-01-03 21:10 ` jakub at gcc dot gnu.org
2011-01-03 21:13 ` jakub 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-47148-4-Ju5ZjHfyCI@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).