public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/31152]  New: -(x>y) generates wrong code
@ 2007-03-12 17:36 anton at mips dot complang dot tuwien dot ac dot at
  2007-03-12 17:43 ` [Bug tree-optimization/31152] " anton at mips dot complang dot tuwien dot ac dot at
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anton at mips dot complang dot tuwien dot ac dot at @ 2007-03-12 17:36 UTC (permalink / raw)
  To: gcc-bugs

The actual gcc version is

gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

When compiled and run with this gcc version, using the command line

gcc -O xxx.c && a.out

the attached program outputs -1, whereas the correct output is 0.  If
I use gcc 3.3.6 or leave away the -O flag, the program produces
correct output.


-- 
           Summary: -(x>y) generates wrong code
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at mips dot complang dot tuwien dot ac dot at
  GCC host triplet: arm-linux-gnu
GCC target triplet: arm-linux-gnu


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


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

* [Bug tree-optimization/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
@ 2007-03-12 17:43 ` anton at mips dot complang dot tuwien dot ac dot at
  2007-03-13 10:20 ` [Bug target/31152] " rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anton at mips dot complang dot tuwien dot ac dot at @ 2007-03-12 17:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anton at mips dot complang dot tuwien dot ac dot at  2007-03-12 17:43 -------
Subject: Re:   New: -(x>y) generates wrong code

I cannot create an attachment in Bugzilla, so I'll just append the
test program here:

#include <stdio.h>
#include <limits.h>

long foo(long x, long y);

int main()
{
  printf("%d\n",foo(INT_MIN,INT_MAX));
  return 0;
}  

long foo(long x, long y)
{
  return -(x>y);
}


-- 


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
  2007-03-12 17:43 ` [Bug tree-optimization/31152] " anton at mips dot complang dot tuwien dot ac dot at
@ 2007-03-13 10:20 ` rguenth at gcc dot gnu dot org
  2007-03-23 21:28 ` fb at frank-buss dot de
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-13 10:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-03-13 10:20 -------
It works for me on x86_64 and i686 with 4.0.0, 4.1.0 and 4.1.2.  So this looks
like a target issue.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |target


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
  2007-03-12 17:43 ` [Bug tree-optimization/31152] " anton at mips dot complang dot tuwien dot ac dot at
  2007-03-13 10:20 ` [Bug target/31152] " rguenth at gcc dot gnu dot org
@ 2007-03-23 21:28 ` fb at frank-buss dot de
  2007-06-19  9:41 ` rearnsha at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fb at frank-buss dot de @ 2007-03-23 21:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fb at frank-buss dot de  2007-03-23 21:27 -------
I can reproduce the problem on a Linkstation Pro with an ARM926EJ CPU. I
compiled GCC SVN revision 123155 from the gcc-4_2-branch on it. Creating wrong
assembler code is at least a major bug, even when using the optimizing switch
(which many programs do), so please change severity to "major".


-- 

fb at frank-buss dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fb at frank-buss dot de


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
                   ` (2 preceding siblings ...)
  2007-03-23 21:28 ` fb at frank-buss dot de
@ 2007-06-19  9:41 ` rearnsha at gcc dot gnu dot org
  2007-06-23 18:07 ` rearnsha at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2007-06-19  9:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rearnsha at gcc dot gnu dot org  2007-06-19 09:41 -------
Confirmed.  This is a bug in the negscc pattern in arm.md.  It's only been
there since 1994!


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-19 09:41:02
               date|                            |


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
                   ` (3 preceding siblings ...)
  2007-06-19  9:41 ` rearnsha at gcc dot gnu dot org
@ 2007-06-23 18:07 ` rearnsha at gcc dot gnu dot org
  2007-06-23 18:11 ` rearnsha at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2007-06-23 18:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rearnsha at gcc dot gnu dot org  2007-06-23 18:07 -------
Subject: Bug 31152

Author: rearnsha
Date: Sat Jun 23 18:07:04 2007
New Revision: 125973

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125973
Log:
        PR target/31152
        * arm.md (negscc): Match the correct operand for optimized LT0 test.
        Remove optimization for GT.
        *gcc.c-torture/execute/20070623-1.c: New.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/20070623-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
                   ` (4 preceding siblings ...)
  2007-06-23 18:07 ` rearnsha at gcc dot gnu dot org
@ 2007-06-23 18:11 ` rearnsha at gcc dot gnu dot org
  2007-06-23 19:07 ` tbm at cyrius dot com
  2007-06-23 19:08 ` tbm at cyrius dot com
  7 siblings, 0 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2007-06-23 18:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rearnsha at gcc dot gnu dot org  2007-06-23 18:11 -------
Fixed on trunk.


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
                   ` (5 preceding siblings ...)
  2007-06-23 18:11 ` rearnsha at gcc dot gnu dot org
@ 2007-06-23 19:07 ` tbm at cyrius dot com
  2007-06-23 19:08 ` tbm at cyrius dot com
  7 siblings, 0 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-06-23 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from tbm at cyrius dot com  2007-06-23 19:07 -------
Are you not going to apply this to 4.1 and 4.2?


-- 


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


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

* [Bug target/31152] -(x>y) generates wrong code
  2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
                   ` (6 preceding siblings ...)
  2007-06-23 19:07 ` tbm at cyrius dot com
@ 2007-06-23 19:08 ` tbm at cyrius dot com
  7 siblings, 0 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-06-23 19:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tbm at cyrius dot com  2007-06-23 19:07 -------
Richard, I think this patch should also be added to the 4.1 and 4.2 branches.


-- 

tbm at cyrius dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu dot
                   |                            |org


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


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

end of thread, other threads:[~2007-06-23 19:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-12 17:36 [Bug tree-optimization/31152] New: -(x>y) generates wrong code anton at mips dot complang dot tuwien dot ac dot at
2007-03-12 17:43 ` [Bug tree-optimization/31152] " anton at mips dot complang dot tuwien dot ac dot at
2007-03-13 10:20 ` [Bug target/31152] " rguenth at gcc dot gnu dot org
2007-03-23 21:28 ` fb at frank-buss dot de
2007-06-19  9:41 ` rearnsha at gcc dot gnu dot org
2007-06-23 18:07 ` rearnsha at gcc dot gnu dot org
2007-06-23 18:11 ` rearnsha at gcc dot gnu dot org
2007-06-23 19:07 ` tbm at cyrius dot com
2007-06-23 19:08 ` tbm at cyrius dot com

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