[m-users.] Uncaught mercury exception using try []

Sean Charles (emacstheviking) objitsu at gmail.com
Fri May 28 06:56:38 AEST 2021


I will indeed raise a bug report, here is the implementation of atrace:

:- pred atrace(string::in, list(string.poly_type)::in) is det.
atrace(Format, Args) :-
    atrace(0, Format, Args).
:- pred atrace(int::in, string::in, list(string.poly_type)::in) is det.
atrace(Level, Format, Args) :-
    utils.ftrace(Level, "FELT_AST", "\n", Format, Args).

and

:- pred ftrace(
    int::in, string::in, string::in, string::in, list(string.poly_type)::in) is det.
ftrace(Level, Flag, Prefix, Format, Args) :-
    trace[io(!Dbg)] (
        utils.get_env_int(Flag, 0, N, !Dbg),
        (if N >= Level then
            io.print(Prefix, !Dbg),
            io.format(Format, Args, !Dbg)
        else true)
    ).






> On 27 May 2021, at 21:54, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> 
> 
> 2021-05-28 05:44 GMT+10:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
>> and the compiler error seems to be in the C code not the mercury code,
> 
> No, that is wrong. This part of the output ...
> 
>> Making Mercury/cs/ast.c
>> Uncaught Mercury exception:
>> Software Error: predicate `check_hlds.try_expand.extract_intermediate_goal_parts'/7: Unexpected: unexpected goal form
>> ** Error making `Mercury/cs/ast.c'.
> 
> ... shows that the error occurred while the Mercury compiler was creating
> the C code.
> 
> The fact that the compiler aborted instead of giving an error message
> means that this may be a compiler bug. Can you please raise the issue
> on https://bugs.mercurylang.org/.
> 
> I am not our expert on the compiler's implementation of exceptions,
> but my *guess* would be that the atrace predicate is det but has no
> outputs (which means that semantically, it is equivalent to true),
> the compiler thus simplifies it away, and then the code that implements
> exception handling is not finding the code it was expecting to find.
> 
> Zoltan.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210527/76e7f958/attachment.html>


More information about the users mailing list