This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/37117] New: reinterpret_cast to different reference or pointer type is overoptimized with -O2
- From: "trash at wobow dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Aug 2008 15:55:10 -0000
- Subject: [Bug tree-optimization/37117] New: reinterpret_cast to different reference or pointer type is overoptimized with -O2
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code outputs "123.456" with no optimization or "-O1", but outputs
a corrupted value when compiled with "-02" or even with "-O1 -fstrict-aliasing
-fschedule-insns2".
#include <iostream>
int main()
{
// binary representation of double value 123.456
unsigned long long ull = 0x405edd2f1a9fbe77ll;
std::cout << reinterpret_cast<double &>(ull) << std::endl;
}
--
Summary: reinterpret_cast to different reference or pointer type
is overoptimized with -O2
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: trash at wobow dot com
GCC host triplet: 2.6.24
GCC target triplet: 2.6.24
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37117