[parisc-linux] FWD: The problematic asm code

Randolph Chung Randolph Chung <randolph@tausq.org>
Fri, 11 Jan 2002 07:25:04 -0800


In reference to a message from Randolph Chung, dated Jan 10:
> Torsten, the Debian ghostscript maintainer, has been working on trying
> to figure out a weird floating-point related (?) problem with the
> ghostscript package on hppa.

As a followup... torsten managed to track this down to a simple test
case:


#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;
}

This gives:
% ./realind
Calling via function pointer: 0.000000
Calling directly: 3.141593

The RTL and the disassembly shows that in the function pointer case gcc
tries to load the floating point argument into an integer register.

A bug has been filed against gcc upstream about this.

randolph
-- 
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^