This is another incarnation of the problem where the optimizer generates code
that uses unchanging memory as a spill spot. The problem can be reproduced as
dogbert> gcc -c -O3 -funroll-loops a.c i.c
dogbert> gcc a.o i.o
In this case the const int q is being written to. This problem occurs only in
gcc 3.4.0, not in gcc 3.3.3 or the mainline.
Created attachment 6155 [details]
code that triggers the bug
Subject: Bug 15112
Module name: gcc
Changes by: email@example.com 2004-05-02 12:37:25
gcc : ChangeLog reload1.c
* reload1.c (reload): Don't record unchanging memory locations.
Fixed on 3.4 branch, see http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00019.html .
I'm closing this PR and will open a new one for mainline because we could devise
more sophisticated ways to address the problem.