[m-users.] Weird compilation error
Zoltan Somogyi
zoltan.somogyi at runbox.com
Sat Oct 3 14:56:29 AEST 2026
On Sat, 03 Oct 2026 06:41:06 +0200, Volker Wysk <post at volker-wysk.de> wrote:
> Regarding way number four: Maybe the compiler could remember how many tail
> recursive calls there are in a predicate/function, the first time they are
> detected. When there are less of them in the second time, you'd know that
> something didn't go as expected...
No, you wouldn't know that. Loop invariant optimization is *designed* to replace
a recursive call with a non-recursive call, so having it do so is NOT unexpected.
Since the new callee is a slightly modified copy of the original predicate,
if the original was tail recursive, the modified copy will also be tail recursive.
(The modification consists only of *deleting* code from the body, getting
the values formerly computed by the deleted code from newly-added input
arguments.)
Zoltan.
More information about the users
mailing list