User account creation filtered due to spam.
Created attachment 26846 [details]
Testcase, file 1
This happens on an OS X 10.4 PPC machine (powerpc-apple-darwin8.11.0) using GCC 4.6.3. Compile the test program with
gcc bug.c magic.c -O2 -o bug
I would expect the output to be 42, but instead I get 123456789. Looking at the pointer arithmetic, M should be equal to L. So it seems that GCC assumes that the assignment of L cannot affect M below.
The value of x matters a lot (but it clearly should not). So far, I only managed to reproduce the problem when x is a pointer to something, casted to an unsigned long.
M = *(unsigned long*)(B + x);
by the equivalent
M = ((unsigned long*)(B))[x/4];
solves the problem.
Might be related to PR49330?
$ gcc -v
Using built-in specs.
Configured with: ../src/configure --prefix=/Users/jdemeyer/sage-5.0.beta7-gcc/local --with-local-prefix=/Users/jdemeyer/sage-5.0.beta7-gcc/local --with-gmp=/Users/jdemeyer/sage-5.0.beta7-gcc/local --with-mpfr=/Users/jdemeyer/sage-5.0.beta7-gcc/local --with-mpc=/Users/jdemeyer/sage-5.0.beta7-gcc/local --with-system-zlib --disable-multilib
Thread model: posix
gcc version 4.6.3 (GCC)
Created attachment 26847 [details]
Testcase, file 2
Not just related but it is the same issue as PR 49330.
*** This bug has been marked as a duplicate of bug 49330 ***