Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 31152
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: anton@mips.complang.tuwien.ac.at
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 31152 depends on: Show dependency tree
Show dependency graph
Bug 31152 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2007-06-19 09:41 Opened: 2007-03-12 17:36
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.

------- Comment #1 From anton@mips.complang.tuwien.ac.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);
}

------- Comment #2 From Richard Guenther 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.

------- Comment #3 From Frank Buss 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".

------- Comment #4 From Richard Earnshaw 2007-06-19 09:41 -------
Confirmed.  This is a bug in the negscc pattern in arm.md.  It's only been
there since 1994!

------- Comment #5 From Richard Earnshaw 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

------- Comment #6 From Richard Earnshaw 2007-06-23 18:11 -------
Fixed on trunk.

------- Comment #7 From Martin Michlmayr 2007-06-23 19:07 -------
Are you not going to apply this to 4.1 and 4.2?

------- Comment #8 From Martin Michlmayr 2007-06-23 19:07 -------
Richard, I think this patch should also be added to the 4.1 and 4.2 branches.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug