[m-users.] That parallel low-level C bug

Volker Wysk post at volker-wysk.de
Mon Sep 14 18:50:34 AEST 2026


Hi!

In Mercury rotd-2026-08-06 I get this error when compiling in the
asm_fast.par.gc.stseg grade:

"Sorry, but the implementation of parallelism for low-level C code
currently has a bug that causes the generated code to be unreliable.
Until that bug is fixed, this mmc does not support this combination."

This must be about that problem that the compiled program crashes or
has weird errors in some Linux distributions, while it works in others.

What is "this combination"? Of grade components? Then I would replace
"this combination" with "the current grade".

Since no "asm_fast.par" grades are available, you need to compile in a
high level C grade instead. But some programs need the tail recursion
optimization, which isn't available there.

I'd like to propose to add a compiler option called, say,
"--allow-par-llc-bug", which turns off the above error. So you can at
least compile for distributions that aren't affected, even if the 
generated binary won't work in other distributions. You might also 
want to write it in capital letters: "--ALLOW-PAR-LLC-BUG".

But please don't spam the compiler output with warning messages about
the problem.

Of course, you also can use an older compiler.

When I try to compile in a high-level C grade, doing this:

:- pragma require_tail_recursion(master_loop_normal/12,
    [error, in_all_grades]).

... then I get:

mfwpar.m:1044: Error in predicate `master_loop_abort'/12:
mfwpar.m:1044:   this self-recursive call is not tail recursive.

And here, please add "in the current grade" to the message.

I'm wondering how bad the lack of tail recursion optimization in hlc
grades is. Is there only a constant amount of stack space available?
Won't it grow automatically? I can't see any hlc grade with ".stseg".
We have multi-gigabytes of RAM nowadays, so if the stack would grow as
needed, it might still work.

Is the fixing of the problem in process? Or maybe it is already fixed 
in the newest ROTD?

Best wishes,
Volker


More information about the users mailing list