Ciao!

This prg seems to have problems with gcc 2.95.2 under FreeBSD.

Here (3.4-stable, egcs from ports) it returns:

rey:/tmp/tmp> ./conftest
00 00 00 00 30 56 0d 28 00 00 00 00 00 5e 3a c8 07 40 bf bf 97 bc 04 28 7d 82 04
08 04 cf 8a 06 b4 8f 05 28 40 d0 bf bf 
5e 3a c8 43 

It should return the 'value' at 'retframe+8' instead of 0. The value is a bit
shifted 'retvalue+13' and latest byte missed.
If you change the value type from 'float' to 'long double' it works correctly.

Any hints ?

Thanks.


<-*- cut -*->
#include <sys/types.h>

float value = 400.456;

float floatValue()
{
        return value;
}

void main()
{
        int i;
        char *(imp) = floatValue;
        void* retframe;
        void* frame = __builtin_apply_args(); //malloc(116);

        retframe = __builtin_apply((void(*)(void))imp, frame, 0);
        for(i=0; i < 40; i++)
                printf("%02x ", ((unsigned char *)retframe)[i]);
        printf("\n");
        for(i=0; i < 4; i++)
                printf("%02x ", ((unsigned char *)&value)[i]);
        printf("\n");

        exit(0);
}
<-*- cut -*->

--
Bye,
Mirko  <[EMAIL PROTECTED]>  (NeXTmail, MIME)




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to