mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-13 12:53:53 +00:00
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
99 lines
2.5 KiB
Mathematica
99 lines
2.5 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Author: Ralph Becket <rafe@cs.mu.oz.au>
|
|
%
|
|
% This is a regression test for a bug involving the interaction of the mode
|
|
% system and quantification, triggered by the state variable transformation.
|
|
%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module state_var_mode_bug.
|
|
|
|
:- interface.
|
|
|
|
:- import_module bool.
|
|
:- import_module int.
|
|
|
|
:- pred p(bool::in, bool::in, int::in, int::out) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
p(A, B, !Y) :-
|
|
some [!X] (
|
|
p0(!:X),
|
|
p2(!X),
|
|
p2(!X),
|
|
(
|
|
A = yes
|
|
->
|
|
(
|
|
B = yes,
|
|
p1(!.X),
|
|
p2(!X),
|
|
p1(!.X)
|
|
;
|
|
B = no,
|
|
(
|
|
p1(!.X),
|
|
p2(!X)
|
|
->
|
|
p1(!.X)
|
|
;
|
|
true
|
|
)
|
|
)
|
|
;
|
|
(
|
|
p1(!.X),
|
|
p2(!X)
|
|
->
|
|
(
|
|
A = yes,
|
|
p1(!.X),
|
|
p2(!X),
|
|
% The bug occurs here. The final value of !X is defined
|
|
% in both branches of this switch, but this final value
|
|
% is not used. The unique modes can therefore optimize away
|
|
% the copy unification in the "no" branch, but cannot
|
|
% optimize away the binding of the variable representing
|
|
% the value in the call to p2 in the "yes" branch. Later
|
|
% compiler passes that check whether the two branches bind
|
|
% the same set of variables in the process of recomputing
|
|
% instmap delta then find that they don't, leading to a
|
|
% compiler abort.
|
|
(
|
|
B = yes,
|
|
p2(!X)
|
|
;
|
|
B = no
|
|
)
|
|
;
|
|
A = no
|
|
)
|
|
;
|
|
p1(!.X)
|
|
->
|
|
p1(!.X),
|
|
p2(!X),
|
|
p1(!.X)
|
|
;
|
|
true
|
|
)
|
|
)
|
|
).
|
|
|
|
:- pred p0(int::out) is det.
|
|
|
|
p0(0).
|
|
|
|
:- pred p1(int::in) is semidet.
|
|
|
|
p1(1).
|
|
|
|
:- pred p2(int::in, int::out) is semidet.
|
|
|
|
p2(!X) :-
|
|
p1(!.X).
|