[m-dev.] mmc bug

Mark Brown mark at cs.mu.OZ.AU
Wed Mar 8 01:29:50 AEDT 2006


On 07-Mar-2006, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Peter Schachte, Tuesday,  7 March 2006:
> >     ground.m:057: In clause for `label((any >> ground))':
> >     ground.m:057:  mode error: argument 1 did not get sufficiently
> >     instantiated.
> >     ground.m:057:  Final instantiatedness of `HeadVar__1' was
> >     `bound((list.[]) ;
> >     ground.m:057:   list.'[|]'(any, any))',
> >     ground.m:057:   expected final instantiatedness was `ground'.

> > :- pred label(list(fdvar)::(any>>ground)) is nondet.
> >
> > label([]).
> > label([X | Xs]):-
> >         label1(X),
> >         label(Xs).
> > 
> > :- pred label1(fdvar::(any>>ground)) is nondet.

> 
> The problem here is that the compiler hasn't inferred that since the
> spine of the list argument to label/1 must be ground (list/1 isn't a
> solver type) and the argument has become ground, then the whole
> thing must be ground afterwards.

That'd be it.  You can check what inst changes the mode analyser knows about
with mmc option `-d35' (`--dump-hlds modecheck'); you may also need to use
`--dump-hlds-options' -- I don't know offhand.

I think this is going to be a general problem if we want to use the mode
system the way we have been talking about recently.  For example, requiring
that variables are ground before being existentially quantified away will
be very tricky when then compiler introduces new variables -- which is
something that it will do all the time.  Naively inserting a satisfiability
check could be a big problem!

Peter, how about you quickly whip up a groundness analyser for us?  ;-)

Cheers,
Mark.

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