[Bug tree-optimization/37115] New: reinterpret_cast to different reference or pointer type is overoptimized with -O2

2008-08-13 Thread trash at wobow dot com
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 
int main()
{
// binary representation of double value 123.456
unsigned long long ull = 0x405edd2f1a9fbe77ll;
std::cout << reinterpret_cast(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=37115



[Bug tree-optimization/37117] New: reinterpret_cast to different reference or pointer type is overoptimized with -O2

2008-08-13 Thread trash at wobow dot com
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 
int main()
{
// binary representation of double value 123.456
unsigned long long ull = 0x405edd2f1a9fbe77ll;
std::cout << reinterpret_cast(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



[Bug tree-optimization/37117] reinterpret_cast to different reference or pointer type is overoptimized with -O2

2008-08-13 Thread trash at wobow dot com


--- Comment #1 from trash at wobow dot com  2008-08-13 15:56 ---
I was actually violating strict aliasing rules with this code!


-- 

trash at wobow dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37117