[m-rev.] diff: fix hlc_nest bug

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Mar 21 03:28:46 AEDT 2002


My change a while back to generate closure layouts turned out to break
the hlc_nest (--gcc-nested-functions) grades.  Here's the fix.

Estimated hours taken: 0.75
Branches: main

compiler/ml_closure_gen.m:
	Fix a bug that broke `hlc_nest' grades: eliminate any duplicate
	constant definitions produced by ml_gen_closure_layout.

Workspace: /home/ceres/fjh/ws-ceres3/mercury
Index: compiler/ml_closure_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_closure_gen.m,v
retrieving revision 1.6
diff -u -d -r1.6 ml_closure_gen.m
--- compiler/ml_closure_gen.m	20 Mar 2002 16:10:02 -0000	1.6
+++ compiler/ml_closure_gen.m	20 Mar 2002 16:22:19 -0000
@@ -157,7 +157,12 @@
 		MaybeConsName, Var, ExtraArgRvals, ExtraArgTypes, ArgVars,
 		ArgModes, HowToConstruct, Context,
 		MLDS_Decls0, MLDS_Statements),
-	{ MLDS_Decls = ClosureLayoutDecls ++ MLDS_Decls0 }.
+	{ MLDS_Decls1 = ClosureLayoutDecls ++ MLDS_Decls0 },
+	% We sometimes generates two definitions of the same RTTI constant
+	% in ml_gen_closure_layout (e.g. two definitions of the same
+	% pseudo_type_info).  To avoid generating invalid MLDS code,
+	% we need to check for and eliminate any duplicate definitions here.
+	{ MLDS_Decls = list__remove_dups(MLDS_Decls1) }.
 
 	%
 	% Generate a value for the closure layout struct.

-- 
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