public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/41917]  New: Strange athrithmetic result with -O3
@ 2009-11-02 21:51 chenyang at cs dot utah dot edu
  2009-11-02 21:56 ` [Bug c/41917] " regehr at cs dot utah dot edu
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: chenyang at cs dot utah dot edu @ 2009-11-02 21:51 UTC (permalink / raw)
  To: gcc-bugs

Using r153799, the following program gives strange result with -O3.

yang@yang-working:~$ svngcc -O3 -o small small.c
yang@yang-working:~$ ./small 
g_64 = 0
yang@yang-working:~$ cat small.c
#include <stdio.h>

unsigned int g_64 = 1;

int
main (void)
{
  unsigned int *l_65 = &g_64;
  unsigned int x = 0xC7D24B5E;
  unsigned int y = *l_65 | -2;
  unsigned int m = (y == 0) ? x : (x % y);

  if (m != x)
    {
      g_64 = 0;
    }

  printf ("g_64 = %x\n", g_64);
  return 0;
}

yang@yang-working:~$ svngcc -v
Using built-in specs.
COLLECT_GCC=svngcc
COLLECT_LTO_WRAPPER=/home/yang/compilers/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --enable-lto --prefix=/home/yang/compilers
--program-prefix=svn --enable-languages=c,c++
--with-libelf=/home/yang/compilers : (reconfigured) ../configure --enable-lto
--prefix=/home/yang/compilers --program-prefix=svn
--with-libelf=/home/yang/compilers --enable-languages=c,lto,c++ --no-create
--no-recursion : (reconfigured) ../configure --enable-lto
--prefix=/home/yang/compilers --program-prefix=svn
--with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create
--no-recursion
Thread model: posix
gcc version 4.5.0 20091102 (experimental) (GCC)


-- 
           Summary: Strange athrithmetic result with -O3
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chenyang at cs dot utah dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2010-02-16  8:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
2009-11-02 21:56 ` [Bug c/41917] " regehr at cs dot utah dot edu
2009-11-02 22:24 ` chenyang at cs dot utah dot edu
2009-11-02 22:36 ` jakub at gcc dot gnu dot org
2009-11-03 22:37 ` [Bug rtl-optimization/41917] " jakub at gcc dot gnu dot org
2009-11-03 22:40 ` jakub at gcc dot gnu dot org
2009-11-14 16:33 ` mikpe at it dot uu dot se
2009-11-14 16:35 ` jakub at gcc dot gnu dot org
2009-11-14 19:43 ` [Bug rtl-optimization/41917] [4.3 Regression] " rguenth at gcc dot gnu dot org
2010-01-02 16:31 ` rguenth at gcc dot gnu dot org
2010-02-16  8:16 ` bonzini at gnu dot org
2010-02-16  8:16 ` bonzini 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).