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 c/13116] New: optimization issue


Code snippet below gives wrong result when compiled with -O1,-O2 or -O3
Unoptimized it works fine.

int main()
{
  unsigned int x = 0x21;

  if(!(x & 0x04) && !(x & 0x20))  ------> this shoud always evaluate to false
  {
    printf("we should not be here!!!! \n");
  }
  return 0;
}


Output of gcc -v is :
Reading specs from /opt/cross/lib/gcc-lib/powerpc64-linux/3.2/specs
Configured with: /usr/src/packages/BUILD/cross-ppc64-gcc-3.2/gcc-3.2/configure
--enable-languages=c,c++,f77 --prefix=/opt/cross --host=powerpc-suse-linux
--target=powerpc64-linux --enable-threads=posix --disable-nls --enable-shared
--with-headers=/usr/src/packages/BUILD/cross-ppc64-gcc-3.2/include-ppc64-glibc-2.2.5
Thread model: posix
gcc version 3.2

-- 
           Summary: optimization issue
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mkumar_70 at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: host=powerpc-suse-linux
GCC target triplet: target=powerpc64-linux


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


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