[MLton-devel] cvs commit: C codegen cleanup
Matthew Fluet
fluet@cs.cornell.edu
Thu, 15 May 2003 09:21:20 -0400 (EDT)
> This seems to be a problem with Real.class.
I think I've narrowed this down to a gcc bug:
[fluet@cfs32 test 8]% cat z.c
#include <stdio.h>
#include <mlton-basis.h>
int main(int argc, char* argv[]) {
printf("%f = %i\n", 1.0, Real_class(1.0));
printf("%f = %i\n", 0.0, Real_class(0.0));
printf("%f = %i\n", 0.0 / 0.0, Real_class(0.0 / 0.0));
return 1;
}
[fluet@cfs32 test 9]% mlton.cvs.HEAD -debug false z.c ; ./z
1.000000 = 4
0.000000 = 4
nan = 4
[fluet@cfs32 test 10]% mlton.cvs.HEAD -debug true z.c ; ./z
1.000000 = 4
0.000000 = 3
nan = 0
So, with -debug false, it's obviously wrong.
Now, if we don't -O2 Real.c in runtime/basis:
[fluet@cfs32 mlton.cvs.HEAD]$ cvs diff runtime/Makefile
Index: runtime/Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/Makefile,v
retrieving revision 1.56
diff -r1.56 Makefile
347a348,350
> basis/Real.o: basis/Real.c
> $(CC) -c -o $@ $<
>
[fluet@cfs32 mlton.cvs.HEAD 58]% make -C runtime clean ; make runtime
...
[fluet@cfs32 test 11]% mlton.cvs.HEAD -debug false z.c ; ./z
1.000000 = 4
0.000000 = 3
nan = 0
[fluet@cfs32 test 12]% mlton.cvs.HEAD -debug true z.c ; ./z
1.000000 = 4
0.000000 = 3
nan = 0
[fluet@cfs32 test 13]% gcc -v
Reading specs from
/usr/u/fluet/gcc/install/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../configure --enable-languages=c
--prefix=/tmp/fluet.tmp/gcc/install
Thread model: posix
gcc version 3.2
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel