[m-rev.] diff: fix for --nondet-copy-out bug

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Jul 7 02:53:41 AEST 2001


Estimated hours taken: 3.5

Fix a bug reported by Peter Ross <petdr at miscrit.be> that was affecting nondet
code generation for the .NET back-end.

compiler/ml_call_gen.m:
	Fix a bug where we were pushing a success continuation in
	ml_gen_success_cont, but never popping it.  The fix is
	just to not push it in the first place; the only place
	this continuation will be used is in the caller, ml_gen_mlds_call, 
	and it gets returned directly to the caller, so it doesn't need
	to get pushed onto the success continuation stack.

tests/hard_coded/Mmakefile:
tests/hard_coded/nondet_copy_out.m:
tests/hard_coded/nondet_copy_out.exp:
	Add a regression test.

Workspace: /mnt/mars/home/mars/fjh/ws1/mercury
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.24
diff -u -d -r1.24 ml_call_gen.m
--- compiler/ml_call_gen.m	2001/06/22 09:14:29	1.24
+++ compiler/ml_call_gen.m	2001/07/06 16:36:28
@@ -489,7 +489,6 @@
 		ml_get_env_ptr(EnvPtrRval),
 		{ NewSuccessCont = success_cont(ContFuncLabelRval,
 			EnvPtrRval, OutputArgTypes, OutputArgLvals) },
-		ml_gen_info_push_success_cont(NewSuccessCont),
 		{ Cont = NewSuccessCont }
 	).
 
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.121
diff -u -d -r1.121 Mmakefile
--- tests/hard_coded/Mmakefile	2001/06/22 03:14:32	1.121
+++ tests/hard_coded/Mmakefile	2001/07/06 16:44:04
@@ -81,6 +81,7 @@
 	no_fully_strict \
 	no_inline \
 	nondet_ctrl_vn \
+	nondet_copy_out \
 	nullary_ho_func \
 	pragma_c_code \
 	pragma_export \
@@ -215,6 +216,7 @@
 MCFLAGS-no_fully_strict	=	--no-fully-strict
 MCFLAGS-intermod_c_code =	--intermodule-optimization
 MCFLAGS-intermod_c_code2 =	--intermodule-optimization
+MCFLAGS-nondet_copy_out =	--no-inlining --nondet-copy-out
 MCFLAGS-redoip_clobber	=	--no-inlining
 MCFLAGS-rnd		=	-O6
 MCFLAGS-split_c_files	=	--trace deep
Index: tests/hard_coded/nondet_copy_out.exp
===================================================================
RCS file: nondet_copy_out.exp
diff -N nondet_copy_out.exp
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ nondet_copy_out.exp	Sat Jul  7 02:45:42 2001
@@ -0,0 +1 @@
+success.
Index: tests/hard_coded/nondet_copy_out.m
===================================================================
RCS file: nondet_copy_out.m
diff -N nondet_copy_out.m
--- /dev/null	Thu Mar 30 14:06:13 2000
+++ nondet_copy_out.m	Sat Jul  7 02:45:06 2001
@@ -0,0 +1,24 @@
+% This is a regression test; with `--no-inlining --nondet-copy-out',
+% Mercury 0.10.1 generated code for this which went into an infinite
+% loop.
+
+:- module nondet_copy_out.
+
+:- interface.
+
+:- import_module io.
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+main -->
+	( { p(2) } ->
+		io__write_string("success.\n")
+	;
+		io__write_string("failure.\n")
+	).
+
+:- pred p(int::out) is multi.
+
+p(1).
+p(2).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list