Red Hat Bugzilla – Bug 736933
Code generation bug for ppc64
Last modified: 2012-03-14 09:06:08 EDT
Description of problem:
http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00304.html describes a bug found in upstream gcc which can cause faulty code generation for ppc64 targets. The version of gcc currently in Fedora 16 for powerpc (gcc (GCC) 4.6.1 20110804 (Red Hat 4.6.1-7)) suffers from the bug described.
Specifically I have had it misgenerate code when compiling qemu, leading to garbled debug output. An upstream svn gcc with Alan Modra's patch from that link applied no longer generates faulty code.
Unfortunately, Alan's patch does not trivially backport to the gcc sources used in FC16.
Version-Release number of selected component (if applicable):
Name : gcc
Version : 4.6.1
Release : 7.fc16
Steps to Reproduce:
1. Obtain upstream qemu sources
2. Compile for a ppc64 target, on a ppc64 host
3. Run qemu-system-ppc64 with the -d cpu option
The GPR dumps in /tmp/qemu.log will be corrupted, showing strange characters instead of the expected hex values.
Examining target-ppc/translate.o with objdump -d will show that the code generated by gcc in cpu_dump_state() to compute the address of the format string for the messages in question is incorrect. Specifically it needs to compute the address of the format string within the function's TOC by applying an offset to the TOC pointer in r2. However, it places the code to do this in a window where r2 has been loaded with a pointer to a different function's TOC.
Self contained testcase in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50341
I also have a backport of the patch to redhat/gcc-4_6-branch
I'd like to wait with the backport of this until it is approved and committed to the trunk.
Can we get target-ppc/translate.i attached here so we can create a minimal test case?
Oops, Alan mentioned that the reduced test case is attached to the GCC PR, so that's good enough for me.
Doesn't look like it's in upstream trunk yet, at least didn't see it there yet.
Thanks & regards, phil
Upstream patch submitted.
Upstream patches committed to trunk and the FSF 4.6 branch.
This is in gcc-4.6.1-10.fc16.
Now that the fix is in gcc upstream, any ETA on getting it into the FC16 package?
See previous comment? The packages are now in f16-updates-testing, you can test them and give them karma if you want to have them pushed as errata sooner.
(In reply to comment #10)
> See previous comment? The packages are now in f16-updates-testing, you can
> test them and give them karma if you want to have them pushed as errata sooner.
As we're on ppc and the kohi-shadow instance wont pick this up automatically until it hits updates. I've started a manual build for ppc and ppc64 at:
Assuming that's successful and the RPMS are fixed I'll bump the karma for you.
Jakub, sorry I misread the earlier comment.
Tony, thanks, I'll check those when I get back.