[mercury-users] Getting 'any' insts to ground
Fergus Henderson
fjh at cs.mu.oz.au
Tue Nov 11 22:15:46 AEDT 1997
Bas de Bakker, you wrote:
> BUG REPORT: If I change the declaration of get_value to cc_multi, I
> get an internal compiler error.
>
> > :- pred is_ground(var(T), maybe(T)).
> > :- mode is_ground(in(any), out) is cc_multi.
Thanks for the report. I'll investigate that one.
> This raises quite a different problem. Let's say we have something
> like
>
> var__init(X),
> dosomething(X),
> is_ground(X, Y).
>
> The compiler could (at least in the commutative semantics) call
> is_ground _before_ dosomething, making Y equal to 'no' (which is a
> correct interpretation of the declarative semantics of the program).
True, but since that _is_ a correct interpretation of the program's
declarative semantics, that should be OK, unless the program is buggy.
So what's the problem?
> > Fortunately there are a number of different solutions to this problem
> > of calling cc_multi predicates from a det context, as has been
> > discussed in detail in recent mail to mercury-users. I haven't
> > investigated how well they work in these sort of cases, however.
>
> As I've only been on this list for a few days, I have not seen this
> message and it does not yet seem to be in the archive.
There was a whole thread of messages -- several threads, in fact (the
ones with "one_solution", "promise_one_solution", etc. in the subject
line). Anyway the copy of the mailing list archives on our ftp site is
now fully up-to-date and will now be automatically updated on a daily
basis.
> % Avoid link errors from libtrailed_update.a
> % What is the idea behind this anyway?
> :- pragma c_code("
> void report_goal_floundered(void);
> void report_goal_floundered(void) { exit(1); }
> ").
That is another bug. Sorry about that. This bug slipped through due
to a combination of 3 mistakes (all mine, I'm afraid):
- When editing the code, I changed the name of the function from
report_goal_floundered to ML_var_report_goal_floundered,
but forgot to change the call;
- I failed to spot the resulting warning message that gcc issued;
- the problem was not caught by our regression tests because
although the regression tests which would have caught this
bug had been written, and run (*before* the bug was introduced),
I had forgotten to enable them in our nightly test script.
The proper fix (which will be included in the next release) is
shown below.
Index: extras/trailed_update/var.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/extras/trailed_update/var.m,v
retrieving revision 1.6
diff -u -r1.6 var.m
--- var.m 1997/10/12 13:32:51 1.6
+++ var.m 1997/11/11 10:11:12
@@ -458,7 +458,7 @@
** can't commit, so the goal flounders.
*/
if (old_goal != ML_var_last_goal.prev) {
- report_goal_floundered(old_goal);
+ ML_var_report_goal_floundered(old_goal);
}
break;
--
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 users
mailing list