This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug regression/26180] New: optimization regression on x86-SunOS


/*
% gcc -v
Using built-in specs.
Target: i386-pc-solaris2.9
Configured with: /usr/local/gcc-4.0.2/src/gcc-4.0.2/configure
--enable-languages=c --with-gnu-as
--with-as=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/as
--with-gnu-ld
--with-ld=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/ld
--prefix=/usr/local/gcc-4.0.2/x86-SunOS-gnu-as-ld
Thread model: posix
gcc version 4.0.2
%
% gcc -O0 -o foo foo.c
% foo
z= 1
%
% gcc -O2 -o foo foo.c
% foo
z= 1
%
%
% gcc-4.1 -v
Using built-in specs.
Target: i386-pc-solaris2.9
Configured with: /home/kate/gcc-4.1-20060203/src/gcc-4.1-20060203/configure
--enable-languages=c --with-gnu-as
--with-as=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/as
--with-gnu-ld
--with-ld=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/ld
--prefix=/home/kate/gcc-4.1-20060203/x86-SunOS-gnu-as-ld
Thread model: posix
gcc version 4.1.0 20060203 (prerelease)
%
%
% gcc-4.1 -O0 -o foo foo.c
z = 1
%
% gcc-4.1 -O2 -o foo foo.c
z = -1
%

*/
#include <stdio.h>

int bar(x, y)
int x, y;
{
    int x1, y1;
    int x2, y2;
    unsigned int x3, y3, w;
    int z;

    x1 = (x < (1 << 30));
    y1 = (y < (1 << 30));
    if (x1 && y1) {
        x2 = ((x > 0)? (x): -(x));
        y2 = ((y > 0)? (y): -(y));

        x3 = x2;
        y3 = y2;
        w = x3 * y3;

        if (w >= (1 << 30)) {
          z = 1;
        } else    {
          z = -1;
        }
    }

        return z;
}


int main()
{
  int x, y, z;
  x = 536870912;  /* 2^29 */
  y = 2;
  z = bar(x, y);
printf("z= %d\n", z);
}


-- 
           Summary: optimization regression on x86-SunOS
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kminola at eng dot umd dot edu
 GCC build triplet: i386-pc-solaris2.9
  GCC host triplet: i386-pc-solaris2.9
GCC target triplet: i386-pc-solaris2.9


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]