public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
@ 2006-03-13 13:11 steffen dot zimmermann at philips dot com
2006-03-13 13:12 ` [Bug rtl-optimization/26663] " steffen dot zimmermann at philips dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: steffen dot zimmermann at philips dot com @ 2006-03-13 13:11 UTC (permalink / raw)
To: gcc-bugs
The attached C++ code converts a floating point number from
our internal representation to IEEE format.
When run, the program should print a value of 144. This works
with gcc-3.3.6 at any optimization level (-O1 -- -O3). With
gcc-3.4.x and optimization level -O2 or -O3, it prints 42 instead.
I.e., it seems the "iFloat" variable in CMdilFloat::AsFloat() is
never modified.
Here's the output of the code with various vanilla gcc's, along
with their configuration:
$ uname -a
Linux xxx.xxx.com 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:13:01 EST 2006 i686
i686 i386 GNU/Linux
$ gcc-3.3.6/bin/g++ -v
Reading specs from
/home/steffenz/gcc/install/gcc-3.3.6/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/specs
Configured with: ../gcc-3.3.6/configure
--prefix=/home/steffenz/gcc/install/gcc-3.3.6 --disable-nls
--enable-languages=c,c++
Thread model: posix
gcc version 3.3.6
$ gcc-3.3.6/bin/g++ -O1 -o test test.cpp && ./test
144
$ gcc-3.3.6/bin/g++ -O2 -o test test.cpp && ./test
144
$ gcc-3.3.6/bin/g++ -O3 -o test test.cpp && ./test
144
$ gcc-3.4.0/bin/g++ -v
Reading specs from
/home/steffenz/gcc/install/gcc-3.4.0/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../gcc-3.4.0/configure
--prefix=/home/steffenz/gcc/install/gcc-3.4.0 --disable-nls
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.0
$ gcc-3.4.0/bin/g++ -O1 -o test test.cpp && ./test
144
$ gcc-3.4.0/bin/g++ -O2 -o test test.cpp && ./test
42
$ gcc-3.4.0/bin/g++ -O3 -o test test.cpp && ./test
42
$ gcc-3.4.6/bin/g++ -v
Reading specs from
/home/steffenz/gcc/install/gcc-3.4.6/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with: ../gcc-3.4.6/configure
--prefix=/home/steffenz/gcc/install/gcc-3.4.6 --disable-nls
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.6
$ gcc-3.4.6/bin/g++ -O1 -o test test.cpp && ./test
144
$ gcc-3.4.6/bin/g++ -O2 -o test test.cpp && ./test
42
$ gcc-3.4.6/bin/g++ -O3 -o test test.cpp && ./test
42
--
Summary: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or
gcc-3.3.6)
Product: gcc
Version: 3.4.6
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steffen dot zimmermann at philips dot com
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=26663
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/26663] Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
2006-03-13 13:11 [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6) steffen dot zimmermann at philips dot com
@ 2006-03-13 13:12 ` steffen dot zimmermann at philips dot com
2006-03-13 13:38 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: steffen dot zimmermann at philips dot com @ 2006-03-13 13:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from steffen dot zimmermann at philips dot com 2006-03-13 13:12 -------
Created an attachment (id=11038)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11038&action=view)
C++ source code to reproduce the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26663
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/26663] Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
2006-03-13 13:11 [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6) steffen dot zimmermann at philips dot com
2006-03-13 13:12 ` [Bug rtl-optimization/26663] " steffen dot zimmermann at philips dot com
@ 2006-03-13 13:38 ` rguenth at gcc dot gnu dot org
2006-03-13 14:16 ` pinskia at gcc dot gnu dot org
2006-03-13 14:41 ` jbeitaharon at intrusic dot com
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-03-13 13:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2006-03-13 13:37 -------
This is invalid as it violates C/C++ aliasing rules.
*** This bug has been marked as a duplicate of 21920 ***
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26663
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/26663] Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
2006-03-13 13:11 [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6) steffen dot zimmermann at philips dot com
2006-03-13 13:12 ` [Bug rtl-optimization/26663] " steffen dot zimmermann at philips dot com
2006-03-13 13:38 ` rguenth at gcc dot gnu dot org
@ 2006-03-13 14:16 ` pinskia at gcc dot gnu dot org
2006-03-13 14:41 ` jbeitaharon at intrusic dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-13 14:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-03-13 14:15 -------
* (u_32 *) pFloat = 0x7FFFFFFF; // NaN
That is violating C/C++ aliasing rules.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26663
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/26663] Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
2006-03-13 13:11 [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6) steffen dot zimmermann at philips dot com
` (2 preceding siblings ...)
2006-03-13 14:16 ` pinskia at gcc dot gnu dot org
@ 2006-03-13 14:41 ` jbeitaharon at intrusic dot com
3 siblings, 0 replies; 5+ messages in thread
From: jbeitaharon at intrusic dot com @ 2006-03-13 14:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jbeitaharon at intrusic dot com 2006-03-13 14:40 -------
Subject: Re: Wrong generated code with gcc-3.4.x
-O2 (ok with -O1 or gcc-3.3.6)
Please take me off the CC list for this distribution.
I don't need the "encouragement" of knowing that many people experience
similar frustrations with gcc's poor (or shall I say, uninformative)
warning messages in the case of aliasing rule violations.
Thanks,
Jonathan
pinskia at gcc dot gnu dot org wrote:
>------- Comment #3 from pinskia at gcc dot gnu dot org 2006-03-13 14:15 -------
> * (u_32 *) pFloat = 0x7FFFFFFF; // NaN
>That is violating C/C++ aliasing rules.
>
>
>
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26663
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-03-13 14:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13 13:11 [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6) steffen dot zimmermann at philips dot com
2006-03-13 13:12 ` [Bug rtl-optimization/26663] " steffen dot zimmermann at philips dot com
2006-03-13 13:38 ` rguenth at gcc dot gnu dot org
2006-03-13 14:16 ` pinskia at gcc dot gnu dot org
2006-03-13 14:41 ` jbeitaharon at intrusic dot com
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).