public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13116] New: optimization issue
@ 2003-11-18 21:45 mkumar_70 at yahoo dot com
  2003-11-18 21:49 ` [Bug c/13116] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mkumar_70 at yahoo dot com @ 2003-11-18 21:45 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
@ 2003-11-18 21:49 ` pinskia at gcc dot gnu dot org
  2003-11-18 23:57 ` mkumar_70 at yahoo dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-18 21:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-18 21:49 -------
3.2 is an old release, can you try with 3.3.2?
I cannot reproduce this on the mainline (20030824).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   GCC host triplet|host=powerpc-suse-linux     |powerpc-suse-linux
 GCC target triplet|target=powerpc64-linux      |powerpc64-linux


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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
  2003-11-18 21:49 ` [Bug c/13116] " pinskia at gcc dot gnu dot org
@ 2003-11-18 23:57 ` mkumar_70 at yahoo dot com
  2003-11-18 23:59 ` mkumar_70 at yahoo dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mkumar_70 at yahoo dot com @ 2003-11-18 23:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mkumar_70 at yahoo dot com  2003-11-18 23:57 -------
Thanks for the update. We are doing an Oracle developer release on powerpc and
cannot change compiler versions at this stage. 

-- 


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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
  2003-11-18 21:49 ` [Bug c/13116] " pinskia at gcc dot gnu dot org
  2003-11-18 23:57 ` mkumar_70 at yahoo dot com
@ 2003-11-18 23:59 ` mkumar_70 at yahoo dot com
  2003-11-19  1:51 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mkumar_70 at yahoo dot com @ 2003-11-18 23:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mkumar_70 at yahoo dot com  2003-11-18 23:59 -------
forgot to mention that we are okay with unoptimizing the c file to get around
the issue for this release.

-- 


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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
                   ` (2 preceding siblings ...)
  2003-11-18 23:59 ` mkumar_70 at yahoo dot com
@ 2003-11-19  1:51 ` pinskia at gcc dot gnu dot org
  2003-11-21  1:53 ` janis187 at us dot ibm dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-19  1:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-19 01:51 -------
Sorry but 3.2.x is no longer being updated at all so if this is fixed in 3.3, we will not release 
another 3.2.x release.

-- 


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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
                   ` (3 preceding siblings ...)
  2003-11-19  1:51 ` pinskia at gcc dot gnu dot org
@ 2003-11-21  1:53 ` janis187 at us dot ibm dot com
  2003-11-21  8:41 ` pinskia at gcc dot gnu dot org
  2003-11-21 12:43 ` amodra at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-11-21  1:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis187 at us dot ibm dot com  2003-11-21 01:53 -------
A workaround for the test case that might also be possible for your real code
is to assign the value 0x21 to a global variable, and then initialize the
local variable x from that global variable instead of from the constant.  That
prevents the compiler from performing constant folding here.

This is fixed in GCC 3.3.

-- 


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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
                   ` (4 preceding siblings ...)
  2003-11-21  1:53 ` janis187 at us dot ibm dot com
@ 2003-11-21  8:41 ` pinskia at gcc dot gnu dot org
  2003-11-21 12:43 ` amodra at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-21  8:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-21 08:41 -------
Janis says this is fixed for 3.3 so closing as fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c/13116] optimization issue
  2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
                   ` (5 preceding siblings ...)
  2003-11-21  8:41 ` pinskia at gcc dot gnu dot org
@ 2003-11-21 12:43 ` amodra at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: amodra at gcc dot gnu dot org @ 2003-11-21 12:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at gcc dot gnu dot org  2003-11-21 12:43 -------
For anyone maintaining gcc-3.2, this is the patch that fixes the problem:
http://gcc.gnu.org/ml/gcc-patches/2002-09/msg01714.html


-- 


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


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

end of thread, other threads:[~2003-11-21 12:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-18 21:45 [Bug c/13116] New: optimization issue mkumar_70 at yahoo dot com
2003-11-18 21:49 ` [Bug c/13116] " pinskia at gcc dot gnu dot org
2003-11-18 23:57 ` mkumar_70 at yahoo dot com
2003-11-18 23:59 ` mkumar_70 at yahoo dot com
2003-11-19  1:51 ` pinskia at gcc dot gnu dot org
2003-11-21  1:53 ` janis187 at us dot ibm dot com
2003-11-21  8:41 ` pinskia at gcc dot gnu dot org
2003-11-21 12:43 ` amodra 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).