[m-rev.] for post-commit review: construct initial module_and_imports directly

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Apr 22 16:25:48 AEST 2019



On Mon, 22 Apr 2019 05:54:43 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:

> 
> On Mon, 22 Apr 2019, Zoltan Somogyi wrote:
> 
> > On Mon, 22 Apr 2019 05:13:04 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:
> >>> One of them (at least) is being triggered:
> >>>
> >>>    Uncaught Mercury exception:
> >>>    Software Error: predicate
> >>>    `parse_tree.modules.grab_imported_modules_augment'/10: Unexpected: bad
> >>>    IntItems
> >>>    Stack dump not available in this grade.
> >>>
> >>> I'll extract a test case for this one.
> >>
> >> Actually, you can ignore that one, it was caused by a foreign_type
> >> pragma being present in a module interface.
> >
> > The mere presence of a foreign_type pragma in the interface
> > does not cause an exception on my machine.
> 
> You probably don't have enough submodules present ;-)
> 
> > If you have a test
> > case for which it does, then I would like to see it.
> 
> Attached, do:
> 
>     $ mmc --make lib12
> 
> to reproduce it.   The foreign_type in question is in the file seq.m.

The cause of the abort was this:

SortedOldIntItems:- type g12.seq.seq(T).
:- pragma foreign_type(c, g12.seq.seq(T), "MR_ArrayPtr", [can_pass_as_mercury_type]).
:- pragma foreign_import_module("C", (g12.seq)).
:- pragma foreign_import_module("C", (g12.seq)).
SortedNewIntItems:- type g12.seq.seq(T).
:- pragma foreign_type(c, g12.seq.seq(T), "MR_ArrayPtr", [can_pass_as_mercury_type]).
:- pragma foreign_import_module("C", (g12.seq)).

Having the old code generate the same item twice is unfortunately
not surprising; that code is so opaque it is hard to see such things in it.

I have committed a fix to the sanity check. Please try it out.

Zoltan.


More information about the reviews mailing list