User account creation filtered due to spam.
When the attached test case is compiled without optimization, it produces the
dogbert> g++ -O0 f.cc
With optimization turned on, it produces this:
dogbert> g++ -O2 f.cc
A minimum of -O2 is needed. This problem occurs with all release versions of the
3.3 and 3.4 branch, as well as the mainline (version 20040908). Actually the
mainline crashes on a segfault for all levels of optimization (including -O0) on
the IA32 platform, but shows the behavior shown above on the AMD64 platform. A
slightly modified version of the code (to account for the fact that this is a
big-endian platform) can also reproduce the same problem on a Sparc platform for
the 3.3 and 3.4 branch; the status of the mainline on Sparc is currently
unknown. Apparantly this problem is platform independent. The 3.2.3 version of
the code behaves correctly on all mentioned platforms, hence this appears to be
Created attachment 7251 [details]
the offending code
Created attachment 7252 [details]
offending code, Sparc version
This is the version of the code that reproduces the problem on Sparc platforms.
Some of the array indices have been swapped to account for the big-endian
nature of the platform.
long long x;
int* y = reinterpret_cast<int*>(x);
you are violating aliasing rules.
(In reply to comment #3)
> you are violating aliasing rules.
You have to forgive my ignorance. If this is violating aliasing rules, shouldn't
the compiler warn about that?
We do for some cases in C but not all, for C++ there is another bug about warning it already.
Reopening to ...
Mark as a dup of bug 21920
*** This bug has been marked as a duplicate of 21920 ***