[m-users.] Question regarding Uncaught Mercury exception.

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon May 7 07:42:50 AEST 2018

On Sun, 6 May 2018 15:41:00 -0400, Harrison Pincket <harrisonpincket at gmail.com> wrote:
> This is only part of the program, but when I compile it I get this error:
> Uncaught Mercury exception:
> Software Error: predicate
> `ml_backend.ml_string_switch.ml_generate_string_binary_simple_lookup_switch'/11:
> Unexpected: model_non

Thank you for your report. That is not an error message intended for users,
but a compiler abort, which indicates a bug in the compiler.

I just checked, and the code you included does not get this abort
from the recent ROTD version of the compiler installed on my laptop;
it just compiles the code, and the resulting executable runs just fine.

Which version of the Mercury compiler were you using?

> I think this error may be due to how I am trying to use the predicate
> er_ending/2. Sure enough it was! Just before sending this mail I changed
> the modes to:
> :- pred er_ending(person, string).
> :- mode er_ending(in, in) is semidet.
> :- mode er_ending(in, out) is det.
> :- mode er_ending(out, out) is multi. <-- changed here.

The abort message says the error occurred when the compiler
attempted to generate code for the switch on the second argument
in the third mode. Making the second argument output in that mode
caused the switch to be replaced by a simple disjunction, so it ceased
tickling the bug.

> I hope you find this email coherent,

Yes, I did, thank you.


More information about the users mailing list