This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
target/5356: Generates bad code for indirect function calls on pa-risc
- From: Torsten Landschoff <torsten at sarti dot debian dot org>
- To: gcc-gnats at gcc dot gnu dot org, debian-gcc at lists dot debian dot org
- Cc: tausq at debian dot org, torsten at debian dot org
- Date: Fri, 11 Jan 2002 02:00:08 +0000
- Subject: target/5356: Generates bad code for indirect function calls on pa-risc
- Reply-to: torsten at debian dot org
>Number: 5356
>Category: target
>Synopsis: Generates bad code for indirect calls on pa-risc
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Jan 10 18:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.0.3 (Debian testing/unstable)
>Organization:
Debian Project
>Environment:
System: Linux sarti 2.4.16-64 #1 Fri Dec 7 16:08:36 MST 2001 parisc64 unknown
Architecture: parisc64
host: hppa-unknown-linux-gnu
build: hppa-unknown-linux-gnu
target: hppa-unknown-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --with-cpp-install-dir=bin hppa-linux
>Description:
The Ghostscript binary built with gcc 3.0.3 on pa-risc is incorrect. I
tracked the problem to the code generated by gcc when calling a function
via a function pointer. Interestingly this only applies to the
floating point arguments. Everything else seems to work fine.
Here is what I consider a very nice example of the problem:
---
#include <stdio.h>
void out(const char *str, double x)
{
printf("%s: %f\n", str, x);
}
int main(int argc, char **argv)
{
void (*f)(const char *, double) = out;
f("Calling via function pointer", 3.1415926535);
out("Calling directly", 3.1415926535);
return 0;
}
---
The output of this program is as follows:
---
torsten@sarti:~/gccbug$ gcc realind.c -o realind -lm
torsten@sarti:~/gccbug$ ./realind
Calling via function pointer: 0.000000
Calling directly: 3.141593
---
>How-To-Repeat:
Building the program above should suffice for repeating the problem. Let
me know if it works on your system :)
>Fix:
I don't know a viable work around. You could avoid using function pointers
or pass the floating point values by reference.
>Release-Note:
>Audit-Trail:
>Unformatted: