public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/5356: Generates bad code for indirect function calls on pa-risc
@ 2002-01-10 18:06 Torsten Landschoff
0 siblings, 0 replies; only message in thread
From: Torsten Landschoff @ 2002-01-10 18:06 UTC (permalink / raw)
To: gcc-gnats, debian-gcc; +Cc: tausq, torsten
>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:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-01-11 2:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-10 18:06 target/5356: Generates bad code for indirect function calls on pa-risc Torsten Landschoff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).