[m-rev.] trivial diff: workaround source distribution build problem

Zoltan Somogyi zs at csse.unimelb.edu.au
Tue Jan 27 18:29:49 AEDT 2009


On 27-Jan-2009, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> The attached test case exhibits the bug, which is an abort
> in the code generator with:

The problem is not in the code generator. The real problem is caused by
incorrect code in instmap_delta_no_output_vars_2 in instmap.m. This code
calls inst_matches_binding to see whether Inst1, the new inst for a variable
specified in an instmap_delta (var 6 in the code of output_library_link_flags)
further instantiates Inst0, the old binding recorded for var 6 in the current
instmap. The problem is that Inst0 specifies only one function symbol to which
var 6 can be bound (executable), while Inst1 specifies two (executable and
shared_library). This occurs for the disjunction

(var70 = "shared" ; var6 = shared_library)

which is inlined into output_library_link_flags.

The Inst0 binding comes from an assignment in the body of
output_library_link_flags before the inlined call.
The Inst1 binding comes from the merge of Inst0 (which is the inst of var6
in the first disjunct) and the new inst of var6 in the second disjunct.

The root cause of the problem of course is that all that
instmap_delta_no_output_vars_2 cares about is instantiatedness,
but the mingling of several concerns in the implementation of insts is
forcing it to also care about uniqueness and bound-to-functor information.

The right fix would be to write a version of inst_matches_binding that
ignores all the information it doesn't need to care about. (It cannot replace
the existing inst_matches_binding, since that is used elsewhere as well.)

By the way, the problem manifests itself in stage 155, when deforestation
(having done nothing) reinvokes determinism analysis, which uses
instmap_delta_no_output_vars_2 to decide whether the above disjunction
is semidet or nondet. It erroneously decides it is nondet, which makes
the body of output_library_link_flags nondet, which is not allowed,
since output_library_link_flags is declared det.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list