[m-dev.] diff: fix bug with middle recursion and trailing

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 15 17:55:27 AEST 1999

Estimated hours taken: 2

Fix a bug which caused tests/general/array_test to fail in trailing grades,
because the compiler miscompiled bt_array__reverse_into_ra_list/3.

	Disable middle recursion if trailing is enabled.

Workspace: /home/mercury0/fjh/mercury
Index: compiler/handle_options.m
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.77
diff -u -r1.77 handle_options.m
--- handle_options.m	1999/08/13 01:42:59	1.77
+++ handle_options.m	1999/10/15 07:31:35
@@ -389,6 +389,14 @@
 	% --use-trail.
 	option_implies(use_trail, optimize_value_number, bool(no)),
+	% XXX if trailing is enabled, middle recursion optimization
+	% can generate code which does not allocate a stack frame 
+	% even though stack slots are used to save and restore the
+	% trail, if the code being optimized contains a construct which
+	% might save/restore the trail state, i.e. an if-then-else,
+	% negation, disjunction, or commit.
+	option_implies(use_trail, middle_rec, bool(no)),
 	% Minimal model tabling needs to be able to rewrite all the redoips
 	% in a given nondet stack segments. If we allow hijacks, some of these
 	% redoips may have been saved in ordinary framevars, which means that

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