public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19788] New: Inconsistent handling of -1.
@ 2005-02-06 10:20 kazu@cs.umass.edu
  2005-02-06 15:29 ` [Bug tree-optimization/19788] " kazu@cs.umass.edu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kazu@cs.umass.edu @ 2005-02-06 10:20 UTC (permalink / raw)
  To: gcc-bugs

Consider:

int
foo (void)
{
  return -1;
}

int
bar (void)
{
  unsigned int a = 0xffffffff;
  return a;
}

int
baz (void)
{
  int a = -1;
  unsigned int b = 0xffffffff;
  return a == (int) b;
}

Here is what I get:

;; Function foo (foo)

foo ()
{
<bb 0>:
  return -1;

}

;; Function bar (bar)

bar ()
{
  int D.1124;

<bb 0>:
  D.1124 = -000000001;
  return D.1124;

}

;; Function baz (baz)

baz ()
{
  int b.0;

<bb 0>:
  b.0 = -000000001;
  return b.0 == -1;

}

Note that -1 is represented in two different ways in foo and bar.
Worse yet, the tree optimizers do not know that they are equal in baz.
baz is optimized as expected at RTL level.

-- 
           Summary: Inconsistent handling of -1.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-03-16 14:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-06 10:20 [Bug tree-optimization/19788] New: Inconsistent handling of -1 kazu@cs.umass.edu
2005-02-06 15:29 ` [Bug tree-optimization/19788] " kazu@cs.umass.edu
2005-02-06 16:05 ` pinskia@gcc.gnu.org
2005-02-06 16:54 ` schlie@comcast.net
2005-02-06 16:54 ` pinskia@gcc.gnu.org
2005-02-08  5:46 ` pinskia at gcc dot gnu dot org
2005-03-16 12:31 ` steven at gcc dot gnu dot org
2005-03-16 14:53 ` kazu at cs dot umass dot edu
2005-03-16 14:54 ` pinskia at gcc dot gnu dot org

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).