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
* [Bug c/41917] Strange athrithmetic result with -O3
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 ` regehr at cs dot utah dot edu
2009-11-02 22:24 ` chenyang at cs dot utah dot edu
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: regehr at cs dot utah dot edu @ 2009-11-02 21:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from regehr at cs dot utah dot edu 2009-11-02 21:56 -------
The problem also appears to exist in 4.4.1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/41917] Strange athrithmetic result with -O3
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
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: chenyang at cs dot utah dot edu @ 2009-11-02 22:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from chenyang at cs dot utah dot edu 2009-11-02 22:24 -------
The expected result is:
g_64 = 1
--
chenyang at cs dot utah dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/41917] Strange athrithmetic result with -O3
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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-02 22:36 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-11-02 22:36:29
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (2 preceding siblings ...)
2009-11-02 22:36 ` jakub at gcc dot gnu dot org
@ 2009-11-03 22:37 ` jakub at gcc dot gnu dot org
2009-11-03 22:40 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-03 22:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2009-11-03 22:36 -------
Subject: Bug 41917
Author: jakub
Date: Tue Nov 3 22:36:39 2009
New Revision: 153874
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153874
Log:
PR rtl-optimization/41917
* rtlanal.c (num_sign_bit_copies1) <case UMOD>: If sign bit of second
operand isn't known to be 0, return 1.
* gcc.c-torture/execute/pr41917.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr41917.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/rtlanal.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-03 22:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2009-11-03 22:40 -------
Subject: Bug 41917
Author: jakub
Date: Tue Nov 3 22:40:08 2009
New Revision: 153875
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153875
Log:
PR rtl-optimization/41917
* rtlanal.c (num_sign_bit_copies1) <case UMOD>: If sign bit of second
operand isn't known to be 0, return 1.
* gcc.c-torture/execute/pr41917.c: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr41917.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/rtlanal.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu dot se @ 2009-11-14 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mikpe at it dot uu dot se 2009-11-14 16:32 -------
This wrong-code bug also occurs with 4.3.4 on i686-linux, but not with 4.2.4 or
4.1.2, making it a regression. The patch for 4.4 applies cleanly to 4.3 and
fixes the bug there with no new regressions (I tested i686, powerpc64, and
arm).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-14 16:35 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|jakub at gcc dot gnu dot org|unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] [4.3 Regression] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (6 preceding siblings ...)
2009-11-14 16:35 ` jakub at gcc dot gnu dot org
@ 2009-11-14 19:43 ` rguenth at gcc dot gnu dot org
2010-01-02 16:31 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-11-14 19:43 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.3.4
Known to work| |4.2.4 4.4.3 4.5.0
Summary|Strange athrithmetic result |[4.3 Regression] Strange
|with -O3 |athrithmetic result with -O3
Target Milestone|--- |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] [4.3 Regression] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (7 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-02 16:31 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|4.3.4 |4.3.4 4.4.2
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] [4.3 Regression] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (9 preceding siblings ...)
2010-02-16 8:16 ` bonzini at gnu dot org
@ 2010-02-16 8:16 ` bonzini at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2010-02-16 8:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from bonzini at gnu dot org 2010-02-16 08:15 -------
Subject: Bug 41917
Author: bonzini
Date: Tue Feb 16 08:15:37 2010
New Revision: 156795
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156795
Log:
PR rtl-optimization/41917
* rtlanal.c (num_sign_bit_copies1) <case UMOD>: If sign bit of second
operand isn't known to be 0, return 1.
testsuite:
* gcc.c-torture/execute/pr41917.c: New test.
Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr41917.c
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/rtlanal.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41917
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug rtl-optimization/41917] [4.3 Regression] Strange athrithmetic result with -O3
2009-11-02 21:51 [Bug c/41917] New: Strange athrithmetic result with -O3 chenyang at cs dot utah dot edu
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: bonzini at gnu dot org @ 2010-02-16 8:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from bonzini at gnu dot org 2010-02-16 08:16 -------
Committed the patch to 4.3 too
--
bonzini at gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to work|4.2.4 4.4.3 4.5.0 |4.2.4 4.3.5 4.4.3 4.5.0
Resolution| |FIXED
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).