Skip to contentSkip to conversation

Broken floating-point varargs

parisc-linux David Huggins-Daines 1 participant 1 message Aug 25, 2000

lore
Share & tools
lore
#0 lore raw

Hi,

The variadic function code in GCC for HPPA is slightly broken for floating point arguments. This only affects the first and second arguments, as all other ones will be passed on the stack.

The problem is that if a function uses va_start(), GCC emits a prologue which stores the first four argument words to their respective stack slots (sp-36 .. sp-48). Unfortunately it does this by simply copying general purpose registers 26 to 23 (arg0-arg3) to these slots, even if some of the first four argument words are (parts of) floating point values and thus reside in floating point registers.

See hppa_builtin_saveregs() in gcc/config/pa/pa.c for the code in question.

It looks like we could fix this by checking the parameters and saving from floating point argument registers instead, I'm just not sure how :-)

I'm wondering whether or not this manifests itself on HP/UX - would it have something to do with (gack) argument relocation?

Signature · 2 lines
[email protected], http://www.linuxcare.com/
Linuxcare. Support for the revolution.