[m-rev.] for post-commit review: fix recompute_instmap_delta of generic calls

Peter Wang novalazy at gmail.com
Fri Aug 29 14:58:41 AEST 2008


On 2008-08-29, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> On 28-Aug-2008, Peter Wang <novalazy at gmail.com> wrote:
> > +:- module instmap_generic_failure.
> > +:- interface.
> > +
> > +:- import_module list.
> > +
> > +:- pred int_to_ascii(pred(int, int), int, list(int), list(int)).
> > +:- mode int_to_ascii(in(pred(in, out) is failure), in, in, out) is semidet.
> > +
> > +:- implementation.
> > +
> > +:- import_module int.
> > +
> > +int_to_ascii(ConvertNonAscii, U, Old, New) :-
> > +    ( U < 128 ->
> > +        New = [U | Old]
> > +    ;
> > +        ConvertNonAscii(U, S),  % failure
> > +        New = [S | Old]
> > +    ).
> 
> The diff to the compiler looks good, but to me this test case looks like
> it could pass even BEFORE the fix is applied. Are you sure it fails
> with an old compiler? An executable test case with an output would be
> better.

The old compiler would abort:

% mmc -C --local-constraint-propagation instmap_generic_failure.m 
Uncaught Mercury exception:
Software Error: instmap.m: Unexpected: merge_instmapping_delta_2: error merging var 8

The instmap for the then branch is something like `reachable([var(New)])'
and the instmap for the else branch was `reachable([])', so it couldn't
merge them.  After the fix, the instmap for the else branch is
`unreachable' so merging succeeds.

Peter

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list