Commit Graph

1 Commits

Author SHA1 Message Date
Peter Wang
72bc36afc2 Fix some problems with static terms in LLDS grades.
compiler/unify_gen.m:
    Add type_info, typeclass_info and ground term constants to the var
    state map using assign_const_to_var instead of assign_expr_to_var.
    expr_is_constant will fail if a constant expression is added with
    the more general assign_expr_to_var, causing missed opportunities
    to construct terms statically in var_locn.m.

    Prevents a compiler abort (bug #457) where mark_static_terms.m
    determines that a term can be constructed statically but var_locn.m
    decides otherwise.

compiler/var_locn.m:
    Do not abort if var_locn_assign_dynamic_cell_to_var is passed
    `construct_statically'. Even after the previous change, it is
    possible for mark_static_terms.m to determine that a cell with a
    dummy type argument can be constructed statically but var_locn.m
    currently does not. This was preventing bootchecks at
    -O5 --intermodule-optimization.

compiler/hlds_goal.m:
    Fix misleading documentation for how_to_construct.

tests/valid/Mercury.options:
tests/valid/bug457.m:
    Add a test case.
2018-04-30 09:41:28 +10:00