target/10408: Two powerpc64 ABI incompatibilities in passing structures by value
amodra@bigpond.net.au
amodra@bigpond.net.au
Tue Apr 15 00:56:00 GMT 2003
>Number: 10408
>Category: target
>Synopsis: Two powerpc64 ABI incompatibilities in passing structures by value
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Apr 15 00:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Alan Modra
>Release: All current 3.x gcc branches
>Organization:
>Environment:
>Description:
The testcase below shows a couple of bugs in the way gcc
handles passing structures by value. The powerpc64 ABI
states that
"The first eight doublewords mapped to the parameter save
area are never stored in the parameter save area by the
calling function. Instead, these doublewords are passed
in registers..."
Bug1: The testcase shows gcc passing the structure on the
stack in the -mstrict-align case. This also happens for
structures of sizes 3,5,6,7 bytes without -mstrict-align.
Bug2: -mstrict-align affects argument padding. With
-mstrict-align, the arg is padded upward in its slot,
without, the arg is padded downward. Thus objects compiled
with -mstrict-align are incompatible with objects compiler
with -mno-strict-align.
>How-To-Repeat:
cat >m.c <<EOF
struct it { char c[2]; };
int foo (struct it x) { return x.c[0]; }
EOF
powerpc64-linux-gcc -O2 -S -mno-strict-align -o z1.s m.c
powerpc64-linux-gcc -O2 -S -mstrict-align -o z2.s m.c
-mno-strict-align
.foo:
rldicl 3,3,56,56
blr
-mstrict-align
.foo:
lbz 3,48(1)
blr
>Fix:
In progress.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list