[m-rev.] for post-commit review: fix infinite loop bug in compiler

Julien Fischer jfischer at opturion.com
Sat Oct 16 23:18:15 AEDT 2021



On Sat, 16 Oct 2021, Zoltan Somogyi wrote:

>
> 2021-10-13 13:07 GMT+11:00 "Julien Fischer" <jfischer at opturion.com>:
>> Rather than printing the .intN contexts, we could just give the context
>> of the insts in the module being compiled and say something like:
>>
>>       ... and the imported insts `foo' and `bar'.
>>
>>
>> (i.e. we would have two different forms of the error message dependent
>> on whether it refers to an imported insts / modes.)
>
> I went with a variation of this: always printing all the inst names in a cycle
> as a list, and then following it up with messages that say "inst iN is defined here"
> after iN's context for just the local insts.
>
> For post-commit review by Julien.

...

> Improve diagnostics for circular insts and modes.

...

> diff --git a/tests/invalid/circ_inst.err_exp b/tests/invalid/circ_inst.err_exp
> index 364e1b542..261b78382 100644
> --- a/tests/invalid/circ_inst.err_exp
> +++ b/tests/invalid/circ_inst.err_exp
> @@ -1,5 +1,7 @@
> -circ_inst.m:011: Error: circular equivalence inst `circ_inst.circ'/0.
> -circ_inst.m:013: Error: circular equivalence insts `circ_inst.circ2'/0 and
> -circ_inst.m:013:   `circ_inst.circ1'/0.
> -circ_inst.m:015: Error: circular equivalence insts `circ_inst.circ1'/0 and
> -circ_inst.m:015:   `circ_inst.circ2'/0.
> +circ_inst.m:011: Inst name `circ'/0 expands to an inst containing itself, which
> +circ_inst.m:011:   means that processing any reference to it would require an
> +circ_inst.m:011:   infinite sequence of expansions.
> +circ_inst.m:013: Inst name `circ1'/0 expands to an inst containing itself
> +circ_inst.m:013:   through `circ2'/0, which means that processing any reference
> +circ_inst.m:013:   to it would require an infinite sequence of expansions.
> +circ_inst.m:015:   The definition of `circ2'/0 is here.

Just one comment: I don't think you should omit the "Error:" prefix on
these messages.

The rest is fine.

Julien.


More information about the reviews mailing list