[m-rev.] Compiler bug in conjunction with modes
Volker Wysk
post at volker-wysk.de
Thu Nov 9 04:15:58 AEDT 2023
Hi
I think I found a compiler bug. The following segment:
:- pred with_connection(pred(T, io, io), T, io, io).
:- mode with_connection(pred(out, di, uo) is det, out, di, uo) is det.
:- mode with_connection(pred(out, di, uo) is cc_multi, out, di, uo) is
cc_multi.
with_connection(Pred, PRes, !IO) :-
Cleanup =
(pred(io.ok::out, !.IO1::di, !:IO1::uo) is cc_multi :-
!:IO1 = !.IO1),
exception.finally( % Line 27
Pred,
PRes,
Cleanup,
_CleanupRes,
!IO).
... leads to this compiler error:
finally.m:027: In clause for `with_connection((pred(out, di, uo) is det),
out,
finally.m:027: di, uo)':
finally.m:027: in call to predicate `exception.finally'/6:
finally.m:027: mode error: arguments
finally.m:027: `Pred, PRes, Cleanup, _CleanupRes, STATE_VARIABLE_IO_0,
STATE_VARIABLE_IO'
finally.m:027: have the following insts:
finally.m:027: (pred(out, di, uo) is det),
finally.m:027: free,
finally.m:027: /* unique */ (pred(out, di, uo) is cc_multi),
finally.m:027: free,
finally.m:027: unique,
finally.m:027: free
finally.m:027: which does not match any of the modes for predicate
finally.m:027: `exception.finally'/6.
It says that the inst of the !:IO argument is free. That's wrong, isn't it?
And when you comment out the ":- mode with_connection... is det." line, it
compiles.
I've attached a module with this, which is ready for compilation.
Cheers,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: finally.m
Type: text/x-objcsrc
Size: 695 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20231108/bf8a7309/attachment.bin>
More information about the reviews
mailing list