[MLton] power pc "port"

Filip Pizlo pizlo@purdue.edu
Tue, 7 Sep 2004 18:43:16 -0500 (EST)


Stephen --

In other programs I've used the GCC options -fno-strict-aliasing, which
allow me to do "evil" things with pointers like the ones you point out at
any optimization level.  Doing a search for "-fno-strict-aliasing" on
google seems to reveal that quite a few projects are using this option
(perl, the linux kernel, postresql, freebsd, etc).

--
Filip Pizlo
http://bocks.psych.purdue.edu/
pizlo@purdue.edu


On Tue, 7 Sep 2004, Stephen Weeks wrote:

> 
> > I'm curious what the problem was with -O2 for the C compiles on
> > Cygwin that caused you (Stephen) to go to -O1.  Just nervous.
> 
> Nothing that we haven't seen before with gcc -O2.  The newer gcc's
> (3.3 IIRC) complain about us not following strict aliasing or
> something like that.  The kind of code that causes problems is like
> this bit in Real/class.c
> 
> ------------------------------------------------------------
> Int Real64_class (Real64 d) {
> 	Word word0, word1;
> 	Int res;
> 
> 	word0 = ((Word *)&d)[0];
> 	word1 = ((Word *)&d)[1];
> ------------------------------------------------------------
> 
> or this bit in Real/gdtoa.c
> 
> ------------------------------------------------------------
> /* This code is patterned on g_dfmt from the gdtoa sources. */
> char * Real64_gdtoa (double d, int mode, int ndig, int *decpt) {
> 	ULong bits[2];
> 	int ex;
> 	static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 };
> 	int i;
> 	ULong *L;
> 	char *result;
> 	ULong sign;
> 
> 	L = (ULong*)&d;
> 	sign = L[_0] & 0x80000000L;
> 	bits[0] = L[_1];
> 	bits[1] = L[_0] & 0xfffff;
> ------------------------------------------------------------
> 
> Basically, anywhere we treat doubels as chunks of two words.
> 
> _______________________________________________
> MLton mailing list
> MLton@mlton.org
> http://www.mlton.org/mailman/listinfo/mlton
>