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 follows: dogbert> gcc -c -O3 -funroll-loops a.c i.c dogbert> gcc a.o i.o dogbert> a.out Segmentation fault 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
Confirmed.
Investigating.
Subject: Bug 15112 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: ebotcazou@gcc.gnu.org 2004-05-02 12:37:25 Modified files: gcc : ChangeLog reload1.c Log message: PR optimization/15112 * reload1.c (reload): Don't record unchanging memory locations. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.428&r2=2.2326.2.429 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.419.4.4&r2=1.419.4.5
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.