Bug 18756 - Optimize setting causes a double/float comparison to break
Summary: Optimize setting causes a double/float comparison to break
Status: RESOLVED DUPLICATE of bug 323
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-01 15:09 UTC by eda-qa
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Non preprocessed file (405 bytes, text/plain)
2004-12-01 15:10 UTC, eda-qa
Details
ii file. (96.08 KB, text/plain)
2004-12-01 15:12 UTC, eda-qa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eda-qa 2004-12-01 15:09:36 UTC
The code demonstrates a case where the optimizer breaks the correctness of the
code.  That is, without optimization the code works as intended, but with
optimization the code triggers the assertion error.

Reproduce:
Compile code: g++ -O0 dlbcomp.cc
Execute: 
Okay

Compile code: g++ -O3 dlbcomp.cc
Execute:
Okay
a.out: dlbcomp.cc:40: int main(int, char**): Assertion `b == d.scalar()' failed.
Aborted

(Code Attached)

(Sorry, I do not have access to a newer GCC build at this time)

> g++ -v -save-temps -O3 dlbcomp.cc
Reading specs from /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking --enable-long-long
--enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java,pascal
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)
 /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/cc1plus -E -D__GNUG__=3
-quiet -v -iprefix /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D_GNU_SOURCE dlbcomp.cc
-O3 dlbcomp.ii
ignoring nonexistent directory "/usr/i586-mandrake-linux-gnu/include"
ignoring nonexistent directory "/usr/i586-mandrake-linux-gnu/include"
ignoring duplicate directory "/usr/include/c++/3.3.1"
ignoring duplicate directory "/usr/include/c++/3.3.1/i586-mandrake-linux-gnu"
ignoring duplicate directory "/usr/include/c++/3.3.1/backward"
ignoring duplicate directory
"/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.1
 /usr/include/c++/3.3.1/i586-mandrake-linux-gnu
 /usr/include/c++/3.3.1/backward
 /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include
 /usr/local/include
 /usr/include
End of search list.
 /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/cc1plus -fpreprocessed
dlbcomp.ii -quiet -dumpbase dlbcomp.cc -auxbase dlbcomp -O3 -version -o dlbcomp.s
GNU C++ version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk) (i586-mandrake-linux-gnu)
        compiled by GNU C version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31972
 as -V -Qy -o dlbcomp.o dlbcomp.s
GNU assembler version 2.14.90.0.5 (i586-mandrake-linux-gnu) using BFD version
2.14.90.0.5 20030722
 /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/collect2 --eh-frame-hdr
-m elf_i386 -dynamic-linker /lib/ld-linux.so.2
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/../../../crt1.o
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/../../../crti.o
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/crtbegin.o
-L/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1
-L/usr//bin/../lib/gcc-lib -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1
-L/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/../../..
-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/../../.. dlbcomp.o -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/crtend.o
/usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/../../../crtn.o
Comment 1 eda-qa 2004-12-01 15:10:25 UTC
Created attachment 7649 [details]
Non preprocessed file
Comment 2 eda-qa 2004-12-01 15:12:07 UTC
Created attachment 7650 [details]
ii file.
Comment 3 Andrew Pinski 2004-12-01 15:12:36 UTC
Not a bug, just a duplicate of PR 323.

*** This bug has been marked as a duplicate of 323 ***

*** This bug has been marked as a duplicate of 323 ***