The test gcc.c-torture/execute/pure-1.c fails on powerpc64-unknown-linux-gnu with -O1 and higher levels of optimization. This happens with mainline, 3.3, and 3.2; I've never been able to build earlier versions of GCC for this target. Alan Modra described the problem and proposed a patch in http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02371.html; that patch has never been reviewed. This was tested with a cross compiler from powerpc-linux on a powerpc64-linux system, which is the usual way to use GCC for this target.
I can confirm on the mainline (20030625), this still happens.
The patch should be reposted to gcc-patches as an "unreviewed" patch.
I would like to know for sure whether src_eqv_elt should have been set earlier.
Probably not. Looking over the code again, it appears to me that src_eqv_elt should only be set when there is a REG_EQUAL note on an insn. See also http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01695.html And what looks like a different approach to fixing the same problem: http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01611.html I'm doing a build now to see if that's the case.
Yes, http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01611.html also fixes the powerpc64-linux pure-1.c failures.
Hmm, there are some interesting differences in the behaviour of the two patches. My patch allows cse to remove the dead calls to link_error*. With Fariborz's patch, the calls stay until combine cleans things up. Also, -O1 code is better with my patch as it allows life analysis to remove stores to i[0..7].
I think this patch is correct -- the ideal solution may be more complicated, but let's not worry about that in stage 3.
Subject: Bug 11229 CVSROOT: /cvs/gcc Module name: gcc Changes by: amodra@gcc.gnu.org 2003-12-03 11:09:56 Modified files: gcc : ChangeLog cse.c Log message: PR target/11229 * cse.c (cse_insn): Set classp using src_const_elt if src_eqv_elt is NULL. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1899&r2=2.1900 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&r1=1.276&r2=1.277
Patch committed for gcc-3.4
Subject: Bug 11229 CVSROOT: /cvs/gcc Module name: gcc Branch: hammer-3_3-branch Changes by: amodra@gcc.gnu.org 2004-01-31 12:38:28 Modified files: gcc : ChangeLog.hammer cse.c Log message: Backport from mainline. 2003-12-03 Alan Modra <amodra@bigpond.net.au> PR target/11229 * cse.c (cse_insn): Set classp using src_const_elt if src_eqv_elt is NULL. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.hammer.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.2.300&r2=1.1.2.301 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.243.2.7&r2=1.243.2.8