Bug 23404 - gij trashes args of functions with more than 8 fp args
Summary: gij trashes args of functions with more than 8 fp args
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.1
: P2 normal
Target Milestone: 3.4.5
Assignee: Alan Modra
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-15 17:27 UTC by Orion Poplawski
Modified: 2005-08-25 01:13 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-linux
Build:
Known to work:
Known to fail: 3.4.5 4.0.2 4.1.0
Last reconfirmed: 2005-08-24 03:52:55


Attachments
Java code to reproduce problem. (23.31 KB, application/octet-stream)
2005-08-15 17:28 UTC, Orion Poplawski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Orion Poplawski 2005-08-15 17:27:24 UTC
This is on a Fedora Core 4 machine:

gij (GNU libgcj) version 4.0.1 20050727 (Red Hat 4.0.1-5)

The to be attached code does not run properly on ppc.  Runs fine on x86 (32 and
64 bit).  The byte-code appears to be correct because it runs fine using the IBM
JVM.

Compiled with:

javac plplot/*/*.java

Run with:

java plplot.examples.x08

The output is the arguments passed to plw3d().  In the source this is:

pls.w3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax,
                           alt[k], az[k] );

Output (first loop) is:

0.0
1.0
1.0
-1.5
1.5
-0.5
1.5
-5.093869927024149
NaN
-3.7431896459052014E-274
5.32506451E-315

Correct output should be:

1.0
1.0
1.0
-1.5
1.5
-0.5
1.5
-5.093869927024149
6.636602508481567
60.0
30.0

It looks like arg1, arg9, arg10, and arg11 are not passed properly.
Comment 1 Orion Poplawski 2005-08-15 17:28:20 UTC
Created attachment 9499 [details]
Java code to reproduce problem.
Comment 2 Andrew Pinski 2005-08-15 17:46:58 UTC
I think this is a libffi issue rather than anything else.
Comment 3 Alan Modra 2005-08-24 03:52:55 UTC
I could not reproduce this problem using a powerpc64 gij.  However, I could when
using a powerpc gij.  Retargetting.
Comment 4 GCC Commits 2005-08-25 00:55:03 UTC
Subject: Bug 23404

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2005-08-25 00:54:54

Modified files:
	libffi         : ChangeLog 
	libffi/src/powerpc: ffi.c 

Log message:
	PR target/23404
	* src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack
	homed fp args.
	(ffi_status ffi_prep_cif_machdep): Correct stack sizing for same.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/ChangeLog.diff?cvsroot=gcc&r1=1.248&r2=1.249
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/src/powerpc/ffi.c.diff?cvsroot=gcc&r1=1.14&r2=1.15

Comment 5 GCC Commits 2005-08-25 00:56:44 UTC
Subject: Bug 23404

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	amodra@gcc.gnu.org	2005-08-25 00:56:36

Modified files:
	libffi         : ChangeLog 
	libffi/src/powerpc: ffi.c 

Log message:
	PR target/23404
	* src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack
	homed fp args.
	(ffi_status ffi_prep_cif_machdep): Correct stack sizing for same.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.222.2.6&r2=1.222.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/src/powerpc/ffi.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.12&r2=1.12.2.1

Comment 6 GCC Commits 2005-08-25 01:10:09 UTC
Subject: Bug 23404

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	amodra@gcc.gnu.org	2005-08-25 01:09:56

Modified files:
	libffi         : ChangeLog 
	libffi/src/powerpc: ffi.c 

Log message:
	PR target/23404
	* src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack
	homed fp args.
	(ffi_status ffi_prep_cif_machdep): Correct stack sizing for same.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.153.4.14&r2=1.153.4.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/src/powerpc/ffi.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.7.10.1&r2=1.7.10.2

Comment 7 Alan Modra 2005-08-25 01:13:10 UTC
Fixed.