Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 2000 17:10:45 +0000
From:      mirko.viviani@rccr.cremona.it
To:        freebsd-hackers@FreeBSD.org
Cc:        obrien@FreeBSD.org
Subject:   GCC 2.95.2 __builtin_apply() problems...
Message-ID:  <200004061510.RAA10378@rccr1.rccr.cremona.it>

next in thread | raw e-mail | index | archive | help
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  <mirko.viviani@rccr.cremona.it>  (NeXTmail, MIME)




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004061510.RAA10378>