Bug 736933 - Code generation bug for ppc64
Code generation bug for ppc64
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: 0xFFFF (Show other bugs)
16
powerpc Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
http://gcc.gnu.org/ml/gcc-patches/201...
:
Depends On:
Blocks: F16Alphappc
  Show dependency treegraph
 
Reported: 2011-09-09 02:16 EDT by David Gibson
Modified: 2012-03-14 09:06 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-10-04 08:29:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Gibson 2011-09-09 02:16:18 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
Architecture: ppc64

How reproducible:


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

Actual results:

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.
Comment 1 Alan Modra 2011-09-09 09:06:53 EDT
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
Comment 2 Jakub Jelinek 2011-09-09 09:12:28 EDT
I'd like to wait with the backport of this until it is approved and committed to the trunk.
Comment 3 Peter Bergner 2011-09-09 10:37:54 EDT
Can we get target-ppc/translate.i attached here so we can create a minimal test case?
Comment 4 Peter Bergner 2011-09-09 11:18:57 EDT
Oops, Alan mentioned that the reduced test case is attached to the GCC PR, so that's good enough for me.
Comment 5 Phil Knirsch 2011-09-15 08:07:02 EDT
Doesn't look like it's in upstream trunk yet, at least didn't see it there yet.

Thanks & regards, phil
Comment 6 Peter Bergner 2011-09-15 14:11:33 EDT
Upstream patch submitted.
Comment 7 Peter Bergner 2011-09-19 14:14:13 EDT
Upstream patches committed to trunk and the FSF 4.6 branch.
Comment 8 Jakub Jelinek 2011-10-04 08:29:50 EDT
This is in gcc-4.6.1-10.fc16.
Comment 9 David Gibson 2011-10-05 03:08:30 EDT
Now that the fix is in gcc upstream, any ETA on getting it into the FC16 package?
Comment 10 Jakub Jelinek 2011-10-05 03:13:45 EDT
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.
Comment 11 Tony Breeds 2011-10-05 05:05:49 EDT
(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:

http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=294416

Assuming that's successful and the RPMS are fixed I'll bump the karma for you.
Comment 12 David Gibson 2011-10-05 10:04:50 EDT
Jakub, sorry I misread the earlier comment.

Tony, thanks, I'll check those when I get back.

Note You need to log in before you can comment on or make changes to this bug.