optimization/3177: Invalid sibcall optimisation on ia64
Andreas Schwab
schwab@suse.de
Wed Jun 13 12:26:00 GMT 2001
>Number: 3177
>Category: optimization
>Synopsis: Invalid sibcall optimisation on ia64
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Jun 13 12:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: =09
>Release: 3.0 20010611 (prerelease)
>Organization:
=09
>Environment:
System: Linux D106 2.4.4-SMP #1 SMP Mon May 14 17:07:47 GMT 2001 ia64 unkno=
wn
Architecture: ia64
host: ia64-suse-linux-gnu
build: ia64-suse-linux-gnu
target: ia64-suse-linux-gnu
configured with: ../configure --enable-threads=3Dposix --enable-long-long -=
-prefix=3D/usr --with-local-prefix=3D/usr/local --infodir=3D/usr/share/info=
--mandir=3D/usr/share/man --enable-languages=3Dc,c++,f77,objc,java --with-=
gxx-include-dir=3D/usr/include/g++ --enable-nls --with-slibdir=3D/lib --ena=
ble-shared ia64-suse-linux
>Description:
The sibcall optimisation causes invalid code to be generated.
>How-To-Repeat:
$ cat sibcall.c
float g (void *a, void *b, int e, int c, float d)
{
return d;
}
float f (void *a, void *b, int c, float d)
{
return g (a, b, 0, c, d);
}
int main ()
{
f (0, 0, 1, 1);
return 0;
}
$ gcc -O2 sibcall.c
$ ./a.out
Illegal instruction
Function f is referencing a stacked register that has never been
allocated:
.global f#
.proc f#
f:
.prologue
.body
.mii
// cycle 0
mov r35 =3D r34
mov r34 =3D r0
;;
The bug does not occur if the type of the last argument of f an g
are changed to int.
>Fix:
--=20
Andreas Schwab "And now for something
SuSE Labs completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanz=E4ckerstr. 10, D-90443 N=FCrnberg
Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list