public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38972] New: Failed constant folding and propagation in arithmetic expression.
@ 2009-01-26 9:39 hironobu dot awazu at gmail dot com
2009-01-26 10:24 ` [Bug c/38972] " rguenth at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: hironobu dot awazu at gmail dot com @ 2009-01-26 9:39 UTC (permalink / raw)
To: gcc-bugs
The following code is expected to print "1."
However, with -O1 or -O2 option, it prints "2."
(-O0 option yields the correct output "1.")
--------------------------------------------
Source code:
#include <stdio.h>
int main (void)
{
int test=1;
volatile int a = 1;
test += (0 == a);
test += ((test + test) <= -69);
printf("%d\n",test);
return 0;
}
--------------------------------------------
Compiler command line: "gcc -O1", "gcc -O2"
--------------------------------------------
Expected results: 1
--------------------------------------------
Observed results: 2
-------------------------------------------------------------
gcc -v output:
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with:
/usr/build/package/orig/test.respin/gcc-3.4.4-3/configure
--verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,pascal,java,objc
--enable-nls
--without-included-gettext
--enable-version-specific-runtime-libs --without-x
--enable-libgcj --disable-java-awt
--with-system-zlib --enable-interpreter
--disable-libgcj-debug --enable-threads=posix
--enable-java-gc=boehm
--disable-win32-registry --enable-sjlj-exceptions
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4
(cygming special, gdc 0.12, using dmd 0.125)
-------------------------------------------------------------
--
Summary: Failed constant folding and propagation in arithmetic
expression.
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hironobu dot awazu at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38972
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/38972] Failed constant folding and propagation in arithmetic expression.
2009-01-26 9:39 [Bug c/38972] New: Failed constant folding and propagation in arithmetic expression hironobu dot awazu at gmail dot com
@ 2009-01-26 10:24 ` rguenth at gcc dot gnu dot org
2009-01-26 19:07 ` pinskia at gcc dot gnu dot org
2009-01-26 19:09 ` [Bug middle-end/38972] " pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-26 10:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-01-26 10:24 -------
This is fixed in GCC 4.3.0 and later. We probably have a duplicate bugreport
somewhere.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38972
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/38972] Failed constant folding and propagation in arithmetic expression.
2009-01-26 9:39 [Bug c/38972] New: Failed constant folding and propagation in arithmetic expression hironobu dot awazu at gmail dot com
2009-01-26 10:24 ` [Bug c/38972] " rguenth at gcc dot gnu dot org
@ 2009-01-26 19:07 ` pinskia at gcc dot gnu dot org
2009-01-26 19:09 ` [Bug middle-end/38972] " pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-26 19:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2009-01-26 19:06 -------
Reopening to ...
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38972
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/38972] Failed constant folding and propagation in arithmetic expression.
2009-01-26 9:39 [Bug c/38972] New: Failed constant folding and propagation in arithmetic expression hironobu dot awazu at gmail dot com
2009-01-26 10:24 ` [Bug c/38972] " rguenth at gcc dot gnu dot org
2009-01-26 19:07 ` pinskia at gcc dot gnu dot org
@ 2009-01-26 19:09 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-26 19:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-01-26 19:09 -------
To mark as fixed for 4.0.0. This has been fixed for a while now. Most likely
the gimplifier fixes it.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c |middle-end
Keywords| |wrong-code
Known to work| |4.0.1
Resolution| |FIXED
Target Milestone|4.3.0 |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38972
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-26 19:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-26 9:39 [Bug c/38972] New: Failed constant folding and propagation in arithmetic expression hironobu dot awazu at gmail dot com
2009-01-26 10:24 ` [Bug c/38972] " rguenth at gcc dot gnu dot org
2009-01-26 19:07 ` pinskia at gcc dot gnu dot org
2009-01-26 19:09 ` [Bug middle-end/38972] " pinskia 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).