Okay... a real bug

Daniel Wang danwang@cs.princeton.edu
Wed, 23 Feb 2000 20:57:38 -0500


From: Daniel Wang <danwang@vista.CS.Princeton.EDU>
Date: 23 Feb 2000 20:57:37 -0500
In-Reply-To: "Stephen Weeks"'s message of "Thu, 2 Dec 1999 10:27:30 -0800 (PST)"
Message-ID: <r8tsnyj2wha.fsf_-_@vista.CS.Princeton.EDU>
Lines: 78
X-Mailer: Gnus v5.7/Emacs 20.4

Segfaults....  it just computes the sum of the first 100 integers.. I think
this is a stack resize bug... 

#include "mlton.h"
#define MY_Int_eq(x,y) (((x) == (y)) ? 1 : 0)
#define MY_halt() \
 (fprintf(stderr,"HALT\n"),exit(0),0)
Globals(0, 0, 1, 1, 0, 0);
BeginIntInfs
EndIntInfs
BeginStrings
String(0, "\n", 1)
EndStrings
DeclareChunk(18);
DeclareChunk(17);
static void ( *nextChunks[])() = {NULL,NULL,NULL,Chunkp(17),Chunkp(17),Chunkp(17),Chunkp(17)};
static ushort frameOffsets0[] = {0};
static GC_frameLayout frameLayouts[] = {{0,NULL},{0,NULL},{0,NULL},{4,frameOffsets0},{8,frameOffsets0},{4,frameOffsets0},{8,frameOffsets0}};
#define initGlobals_8_index 0
#define sum62798_0_index 1
#define main62797_0_index 2
#define L_208_index 3
#define L_209_index 4
#define L_210_index 5
#define L_211_index 6
Chunk(18);
ChunkSwitch
case initGlobals_8_index:
	FarJump(17, main62797_0);
EndChunk
Chunk(17);
DI(0);
DI(1);
DI(2);
DI(3);
DI(4);
DU(0);
ChunkSwitch
case sum62798_0_index:
sum62798_0:
	LimitCheck(8, L_211, 0, StackOverflowCheck);
	RI(0) = MY_Int_eq(SI(4), 0);
	BZ(RI(0), L_205);
L_206:
	GI(0) = 1;
	Return();
L_205:
	RI(2) = MLTON_Int_sub(SI(4), 1);
	SI(12) = RI(2);
	Push(8);
	SI(0) = L_209_index;
	goto sum62798_0;
case main62797_0_index:
	LimitCheck(4, L_210, 0, StackOverflowCheck);
	SI(8) = 100;
	Push(4);
	SI(0) = L_208_index;
	goto sum62798_0;
case L_208_index:
	Push(-4);
	SI(4) = GI(0);
	RI(0) = SI(4);
	print_int(RI(0));
	print_str(GP(0));
		RU(0) = MY_halt();
	MY_FromId(RU(0));
		Return();
case L_209_index:
	Push(-8);
	SI(8) = GI(0);
	RI(3) = SI(8);
	RI(4) = MLTON_Int_add(SI(4), RI(3));
	GI(0) = RI(4);
	Return();
case L_210_index: goto L_210;
case L_211_index: goto L_211;
EndChunk
Main(FALSE, 0, 12, 8, 7, 0xd, 18, initGlobals_8)