[m-dev.] for review: fix bug in unique mode checking

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Apr 9 09:20:40 AEST 1999


On 09-Apr-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Perform some minor simplifications in mode analysis,
> so as to provide more information to unique mode analysis.
> Previously unique_modes.m was reporting spurious errors
> for tests/hard_coded/bidirectional.m, because modes.m
> produced output containing a subgoal of the form
> `disj([Goal, conj([disj([])]])' instead of just `Goal',
> and the presence of a disjunction then caused unique mode
> analysis to make overly conservative assumptions.
> 
> compiler/modes.m:
> 	Ensure that we do not produce singleton conjunctions or disjunctions.
> 	Also, if the result of mode checking a disjunct is a (nested)
> 	disjunction, then merge it with the containing disjunction.
> 	If the nested disjunction is the empty disjunction (fail),
> 	then this means it will be deleted.

Unfortunately this fix broke tests/warnings/simple_code.
In particular, the compiler no longer warns about this case:

	% This should give a warning about the second disjunct never succeeding.
	:- pred r(int, int).
	:- mode r(in(bound(1)), out(bound(42))) is det.

	r(1, 42).
	r(2, 21).

My first inclination is to say oh well, never mind,
and to just comment out that part of that test case.

Would anyone object to 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 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list