[FIX] DOUBLE_WORD_ORDER autoconf fix for gcc 3.2

Ned Konz ned at bike-nomad.com
Tue Apr 22 19:25:20 UTC 2003


On Monday 21 April 2003 09:34 am, Tim Rowledge wrote:
> Ned Konz <ned at bike-nomad.com> wrote:
> > > built into the configure script.
> >
> > It should be fixed; I agree. Do you know why it's not getting it
> > right?
> >
> > > > #define DOUBLE_WORD_ORDER 1
>
> IIRC there is something wrong with the configure system; this issue
> has come up several times over at least a year and maybe two. A
> search of the list archives might reveal more answers - or perhaps
> just more questions. I don't think it's anything particularly
> related to Squeak except in as much as Squeak uses the configure
> program.
>
> tim

The problem is this, for the record:

gcc 3.2 has gotten much cleverer with optimization.

The AC_C_DOUBLE_ORDER test from Ian's aclocal.m4 is this:

main(){ double d= 1.0; return *(int *)&d == 0;}

However, with the default -O2 optimization flag, this program returns 
0, which makes the ac_cv_double_order="yes", which is wrong. Without 
the -O2, this program returns 1.

I *think* the configure program could/should use something like this:

int main(void)
{
	union { double d; int i[ sizeof(double) / sizeof(int) ]; } d;
	d.d = 1.0;
	return d.i[0] == 0;
}

which seems to work right (for me, anyway) with and without 
optimization.

The attached patch to acinclude.m4 should work. Though it should of 
course be tested by people on different platforms.

You have to apply it to platforms/unix/config/acinclude.m4, and then 
run "make" in that directory first.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acinclude.m4.patch
Type: text/x-diff
Size: 842 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030422/511069df/acinclude.m4.bin


More information about the Squeak-dev mailing list