[m-rev.] error in liveness.m (?)
Peter Wang
wangp at students.cs.mu.OZ.AU
Fri Feb 18 16:55:49 AEDT 2005
On Friday 18 February 2005 02:14 pm, Peter Wang wrote:
> The compiler is throwing an exception on the following file (derived from
> tests/general/unused_arg_determinism.m). It's not related to my stack_opt.m
> change from yesterday.
Here's the fix as suggested by Zoltan, bootcheck pending.
Peter
Estimated hours taken: 1.5
Branches: main, release
compiler/stack_opt.m:
Run a simplication pass on procedures before doing liveness
computation. This avoids the compiler throwing an exception
for the test case below.
tests/valid/stack_opt_simplify.m:
tests/valid/Mmakefile:
Add a test case.
Index: compiler/stack_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_opt.m,v
retrieving revision 1.15
diff -u -r1.15 stack_opt.m
--- compiler/stack_opt.m 18 Feb 2005 05:12:41 -0000 1.15
+++ compiler/stack_opt.m 18 Feb 2005 05:45:53 -0000
@@ -87,6 +87,7 @@
:- import_module check_hlds__goal_path.
:- import_module check_hlds__inst_match.
:- import_module check_hlds__mode_util.
+:- import_module check_hlds__simplify.
:- import_module check_hlds__type_util.
:- import_module hlds__arg_info.
:- import_module hlds__code_model.
@@ -223,6 +224,9 @@
; doesnt_need_flush.
stack_opt_cell(PredId, ProcId, !ProcInfo, !ModuleInfo, !IO) :-
+ % This simplication is necessary to fix some bad inputs from
+ % getting to the liveness computation.
+ simplify__proc([], PredId, ProcId, !ModuleInfo, !ProcInfo, !IO),
detect_liveness_proc(PredId, ProcId, !.ModuleInfo, !ProcInfo, !IO),
initial_liveness(!.ProcInfo, PredId, !.ModuleInfo, Liveness0),
module_info_globals(!.ModuleInfo, Globals),
Index: tests/valid/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mercury.options,v
retrieving revision 1.16
diff -u -r1.16 Mercury.options
--- tests/valid/Mercury.options 14 Feb 2005 04:49:17 -0000 1.16
+++ tests/valid/Mercury.options 18 Feb 2005 05:25:04 -0000
@@ -88,6 +88,7 @@
MCFLAGS-solver_type_bug = --halt-at-warn
MCFLAGS-solv = --halt-at-warn
MCFLAGS-spurious_purity_warning = --halt-at-warn
+MCFLAGS-stack_opt_simplify = --optimize-saved-vars
MCFLAGS-tuple_eqv = --smart-recompilation
MCFLAGS-two_way_unif = -O-1
MCFLAGS-typeclass_det_warning = --halt-at-warn
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.149
diff -u -r1.149 Mmakefile
--- tests/valid/Mmakefile 15 Feb 2005 00:04:59 -0000 1.149
+++ tests/valid/Mmakefile 18 Feb 2005 05:25:42 -0000
@@ -173,6 +173,7 @@
some_switch \
spurious_purity_warning \
stack_alloc \
+ stack_opt_simplify \
state_var_bug \
static \
subtype_switch \
Index: tests/valid/stack_opt_simplify.m
===================================================================
RCS file: tests/valid/stack_opt_simplify.m
diff -N tests/valid/stack_opt_simplify.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/valid/stack_opt_simplify.m 18 Feb 2005 05:37:08 -0000
@@ -0,0 +1,22 @@
+% Regression test. `stack_opt_cell' used to call `detect_liveness_proc'
+% without doing a simplification on the procedure beforehand:
+%
+% % mmc --optimize-saved-vars -C stack_opt_simplify.m
+% stack_opt_simplify.m:023: In `bar':
+% stack_opt_simplify.m:023: warning: determinism declaration could be tighter.
+% stack_opt_simplify.m:023: Declared `semidet', inferred `erroneous'.
+% Uncaught Mercury exception:
+% Software Error: goal_info_get_post_births: no code_gen_info
+
+:- module stack_opt_simplify.
+:- interface.
+:- pred foo is det.
+
+:- implementation.
+:- import_module require.
+
+foo :- ( bar -> true ; true ).
+
+% If declared as `is erroneous' then the abort doesn't occur.
+:- pred bar is semidet.
+bar :- error("bar").
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list