Test gcc.c-torture/execute/pr28982b.c started failing execution for all -O2 and -O3 options on powerpc64-linux with -m32 with this patch: http://gcc.gnu.org/viewcvs?view=rev&rev=139993 r139993 | rsandifo | 2008-09-04 18:47:35 +0000 (Thu, 04 Sep 2008) It still fails as of r140162. The test passes with a powerpc-linux compiler with default cpu options but fails with -mcpu=power4 or later.
Confirmed, I see it too. I configure GCC with --with-tune=cell.
With a mainline from today, it fails for me at -O2. Looking into it, it's foo() that is miscompiled (I broke the 3 functions into their own files and recompiled them), It's also the last element of results (ie, results[19] that miscompares (141 versus expected value of 190).
Created attachment 16446 [details] proposed patch Please try this and see if it works. I believe it does, since I see - stw 21,16(9) - addis 21,1,0x8 [lots of code] + stw 21,16(9) + addis 21,1,0x8 which suggests that the memory store hasn't been promoted above where it ought.
The test passes with a simple build of gcc with the patch from comment#3. I fired off a bootstrap and testsuite run.
This problem also showed up as a CPU2000 regression in the Sixtrack benchmark for PPC64, causing problems in the ondering of ld/st instructions. A GCC patched with Richard's fix produced the right code and the regression is gone.
This patch also fixes miscompilation of vla1.f90 test on ia64 on sel-sched branch.
The patch from comment #3 passes bootstrap and regtests on powerpc64-linux.
Fixed.
Subject: Bug 37447 Author: rth Date: Sun Oct 12 20:26:24 2008 New Revision: 141077 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141077 Log: PR middle-end/37447 * Makefile.in (reload1.o): Depend on EMIT_RTL_H. * alias.c (value_addr_p, stack_addr_p): Remove. (nonoverlapping_memrefs_p): Remove IRA special case. * emit-rtl.c (get_spill_slot_decl, set_mem_attrs_for_spill): New. * emit-rtl.h (set_mem_attrs_for_spill): Declare. * reload1.c (alter_reg): Use it. Modified: trunk/gcc/ChangeLog trunk/gcc/Makefile.in trunk/gcc/alias.c trunk/gcc/emit-rtl.c trunk/gcc/emit-rtl.h trunk/gcc/reload1.c
Subject: Bug 37447 Author: hjl Date: Sun Oct 12 21:44:33 2008 New Revision: 141079 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141079 Log: 2008-10-12 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2008-10-12 Richard Henderson <rth@redhat.com> PR middle-end/37447 * Makefile.in (reload1.o): Depend on EMIT_RTL_H. * alias.c (value_addr_p, stack_addr_p): Remove. (nonoverlapping_memrefs_p): Remove IRA special case. * emit-rtl.c (get_spill_slot_decl, set_mem_attrs_for_spill): New. * emit-rtl.h (set_mem_attrs_for_spill): Declare. * reload1.c (alter_reg): Use it. Modified: branches/ira-merge/gcc/ChangeLog.ira branches/ira-merge/gcc/Makefile.in branches/ira-merge/gcc/alias.c branches/ira-merge/gcc/emit-rtl.c branches/ira-merge/gcc/emit-rtl.h branches/ira-merge/gcc/reload1.c