[m-dev.] diff: fix bug with existential types & typeinfo-liveness

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 15 19:50:47 AEST 1999


Estimated hours taken: 1

Fix a bug that broke tests/hard_coded/existential_reordering
in debug grades.

compiler/call_gen.m:
	In call_gen__save_variables, make sure that we delete
	the output arguments _after_ adding the type_info variables;
	otherwise, we may try to save a type_info variable which
	is an output argument (for an existentially typed predicate)
	before it has a value, resulting in an internal compiler error.

Workspace: /d-drive/home/hg/fjh/mercury
Index: compiler/call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/call_gen.m,v
retrieving revision 1.135
diff -u -r1.135 call_gen.m
--- compiler/call_gen.m	1999/09/30 08:55:01	1.135
+++ compiler/call_gen.m	1999/10/15 09:45:42
@@ -433,22 +433,22 @@
 
 %---------------------------------------------------------------------------%
 
-call_gen__save_variables(Args, Code) -->
+call_gen__save_variables(OutArgs, Code) -->
 	code_info__get_known_variables(Variables0),
 	{ set__list_to_set(Variables0, Vars0) },
-	{ set__difference(Vars0, Args, Vars1) },
 	code_info__get_globals(Globals),
 	{ body_should_use_typeinfo_liveness(Globals, TypeInfoLiveness) },
 	( 
 		{ TypeInfoLiveness = yes }
 	->
 		code_info__get_proc_info(ProcInfo),
-		{ proc_info_get_typeinfo_vars_setwise(ProcInfo, Vars1, 
+		{ proc_info_get_typeinfo_vars_setwise(ProcInfo, Vars0, 
 			TypeInfoVars) },
-		{ set__union(Vars1, TypeInfoVars, Vars) }
+		{ set__union(Vars0, TypeInfoVars, Vars1) }
 	;
-		{ Vars = Vars1 }
+		{ Vars1 = Vars0 }
 	),
+	{ set__difference(Vars1, OutArgs, Vars) },
 	{ set__to_sorted_list(Vars, Variables) },
 	call_gen__save_variables_2(Variables, Code).
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list