Files
mercury/tests/debugger/exception_cmd.exp3
Zoltan Somogyi c34f6dd4e8 Let the compiler bootstrap in decldebug grades again.
The big diff that replaced the item list with proper parse trees included code
that the compiler couldn't handle in decldebug grades, aborting with a message
about liveness mismatch between different switch arms. The problem occurred
when compiling this code in generate_missing_start_section_warning_int,
which is one arm of a switch on !.MissingStartSectionWarning:

    !.MissingStartSectionWarning =
        have_not_given_missing_section_start_warning,
    !:MissingStartSectionWarning =
        have_given_missing_section_start_warning,
    Pieces = [invis_order_default_start(1), ...],
    _Spec = error_spec(severity_error, phase_term_to_parse_tree,
        [simple_msg(Context, [always(Pieces)])])

The problem was liveness.m's handling of the from_ground_term_construct
scope that is generated for the assigmnet of the ground term to Pieces.

compiler/liveness.m:
    During the first pass through the procedure body, the liveness pass,
    replace with the empty conjunction any from_ground_term_construct scopes
    that construct terms to assign to dead variables. This prevents the
    second pass, the deadness pass, from including the dead variable
    (Pieces in the above example, after the assignment to _Spec was
    optimized away by earlier passes) in the set of variables that
    have been seen, since obviously, they won't be seen in the other arms.
    This inclusion was the cause of the assertion failure that led to
    the compiler abort.

    Improve the existing debugging infrastructure to help find bugs like this,
    by printing out what the selected procedure's body looks like before
    as well as after the initial requantification.

compiler/quantification.m:
    Replace from_ground_term_construct scopes whose ground term is assigned
    to a dead variable with empty conjunctions, so that the compiler passes
    between the first quantification after mode checking and the liveness
    pass also see a smaller HLDS.

    Implement an unrelated improvement whose possibility I discovered when
    investigating why a version of the test case *without* the from_ground_term
    scope wasn't getting the abort. When processing unifications, build up the
    set of variables in the unification directly, not by recording a bunch
    of maybe(somethings)s and then processing the somethings, if they existed,
    later. This yields code that is shorter, simpler *and* faster.

tests/valid/liveness_disagree.m:
    A new test case for this bug. It is a cut-down version of
    generate_missing_start_section_warning_int.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
    Enable the new test case, and try to compile it in a declarative debugging
    grade.

compiler/assertion.m:
compiler/deep_profiling.m:
compiler/lookup_switch.m:
compiler/par_loop_control.m:
    Add module qualifications in several places. I found the need for these
    when I temporarily redefined the set_of_var type to use sets instead of
    sparse_bitsets, to make debugging the bug in liveness.m easier; without
    them, I got errors about excessive overloading.

    Do some other cleanups as well.

tests/debugger/all_solutions.exp4:
tests/debugger/exception_cmd.exp3:
tests/debugger/loopcheck.exp3:
tests/debugger/uci_index.exp2:
tests/declarative_debugger/Mmakefile:
tests/declarative_debugger/builtin_call_rep.exp:
tests/declarative_debugger/catch_retry.exp:
tests/declarative_debugger/condition_bug.exp:
tests/declarative_debugger/find_origin.exp3:
tests/declarative_debugger/lpe_example.exp3:
tests/declarative_debugger/priv_builtin_bug.exp:
tests/declarative_debugger/solns.exp3:
tests/declarative_debugger/sort.exp:
tests/declarative_debugger/track_through_catch.exp:
tests/declarative_debugger/typed_unify.exp:
    Update all these expected outputs for the changes in line numbers
    caused by my cleanups of the test cases early in 2015.

    For the declarative_debugger/{condition_bug,sort} test cases, also
    update them for the change to print the types and values of foreign types.

tests/hard_coded/type_qual.{m,exp}:
    This test case failed for an earlier version of this diff, so add some
    context to its outputs, to make such failures easier to debug.
    To make *that* easier, bring it to date in programming style.
2015-08-29 13:07:01 +10:00

13 lines
425 B
Plaintext

E1: C1 CALL pred exception_cmd.main/2-0 (det) exception_cmd.m:17
mdb> echo on
Command echo enabled.
mdb> exception
E2: C2 EXCP pred exception.throw_impl/1-0 (erroneous)
mdb> print *
Univ (arg 1) univ_cons(software_error("oops"))
mdb> continue
Uncaught Mercury exception:
Software Error: oops
Last trace event was event #E3.
Last trace event before the unhandled exception was event #E4.