[m-rev.] for post-commit review and request for tryout: simplify a test

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Feb 23 16:46:40 AEDT 2026



On Mon, 23 Feb 2026 16:27:11 +1100, Julien Fischer <jfischer at opturion.com> wrote:

> On Mon, 23 Feb 2026 at 16:00, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> >
> >
> > On Mon, 16 Feb 2026 23:36:35 +1100, Julien Fischer <jfischer at opturion.com> wrote:
> > > Test case attached. Compile with mmc --warn-unused-args -C zt_tree234.m
> > > The problem appears to be related to the presence of the type_spec pragma.
> >
> > I fixed that bug on the 17th. In the absence of either further bug reports,
> > or requests to wait, I intend to delete the old code tomorrow around noon.
> 
> I haven't encountered any further problems.

Thanks for the report.

> (That said, I couldn't compile G12 completely due to Mantis #581.)

I am working on a more comprehensive fix that should fix #578 as well as #581,
but I am not there yet.

However, I think it very likely that simplifying whatever disjunction that crash
occurs (by creating a separate disjunction for each intended switch) would
work around that bug until the fix is ready.

> Question related to --warn-unused-args: Is it actually useful to generate that
> warning for arguments that have mode "unused" (e.g. type_desc.same_type/2)?

No, but right now, the module is not set up to handle that distinction.
This is because in the general case, the predicate involved may have more than one
mode, and both the arg and the mode may (independently) be unused in some
but used in others.

There is an old comment, probably from Simon, in unused_args.m which says that
it reports an arg unused only if it is unused in all modes. I don't see any code that
performs that check, and I don't think there is one. I don't think there CAN be one,
because the code that generates warnings does it on a procedure-by-procedure basis.
To do what that comment says, it would have to

- find the set of unused args in each procedure,
- INTERSECT these sets from all the procedures in a predicate,
- and THEN generate the warning for the args in the intersection.

We could tweak the first step to delete an unused arg its mode says it is unused.
I will look into it.

Zoltan.







More information about the reviews mailing list