[m-rev.] diff: add a test case for a bug

Julien Fischer juliensf at cs.mu.OZ.AU
Mon May 23 18:36:25 AEST 2005


(NOTE: at the moment I don't think this is a problem for the release
 branch.  When/If some of the more recent changes on the main branch,
 such as the field update optimization (and related changes) get
 merged onto the release branch it may become a problem).

Estimated hours taken: 2
Branches: main

tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/constraint_prop_bug.m:
	Add a test case for the bug that has been causing the building
	of stage 2 to abort in the nightly tests (on machines compiling at -O3
	and above.  The bug seems to be caused by the constraint propagation
	pass, although we're still investigating that.

Julien.

Index: Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mercury.options,v
retrieving revision 1.20
diff -u -r1.20 Mercury.options
--- Mercury.options	2 May 2005 08:19:08 -0000	1.20
+++ Mercury.options	23 May 2005 08:23:24 -0000
@@ -32,6 +32,7 @@
 MCFLAGS-base_relation2		= --aditi
 MCFLAGS-base_relation		= --aditi
 MCFLAGS-compl_unify_bug		= -O3
+MCFLAGS-constraint_prop_bug	= -O0 --common-struct --local-constraint-propagation
 MCFLAGS-context_anc		= --aditi
 MCFLAGS-deforest_bug		= -O3
 MCFLAGS-deforest_loop		= -O3 --intermodule-optimization
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.153
diff -u -r1.153 Mmakefile
--- Mmakefile	13 May 2005 02:24:20 -0000	1.153
+++ Mmakefile	23 May 2005 08:22:55 -0000
@@ -67,6 +67,7 @@
 	compl_unify_bug \
 	constrained_poly_bound_arg \
 	constrained_poly_insts \
+	constraint_prop_bug \
 	constructor_arg_names \
 	dcg_test \
 	deforest_bug \
Index: constraint_prop_bug.m
===================================================================
RCS file: constraint_prop_bug.m
diff -N constraint_prop_bug.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constraint_prop_bug.m	23 May 2005 08:22:12 -0000
@@ -0,0 +1,60 @@
+% Compiling the following with rotd-2005-05-23 with
+% -O0 --common-struct --local-constraint-propagation
+% causes the following assertion failure:
+%
+%	Uncaught Mercury exception:
+%	Software Error: nondet model in det/semidet context
+%
+% NOTE: this is a regression, it didn't occur with
+%       rotd-2005-05-17 and before.
+%
+:- module constraint_prop_bug.
+
+:- interface.
+
+:- import_module list.
+:- import_module std_util.
+
+:- type hlds_goal == pair(hlds_goal_expr, hlds_goal_info).
+
+:- type hlds_goal_info ---> hlds_goal_info.
+
+:- type hlds_goal_expr ---> hlds_goal_expr.
+
+:- type proc_info ---> proc_info.
+
+:- pred copy_clauses_to_proc(list(hlds_goal)::in, proc_info::out) is det.
+
+:- implementation.
+
+:- type purity	---> pure ; not_pure.
+
+copy_clauses_to_proc(GoalList, Proc) :-
+ 	GoalInfo0 = hlds_goal_info,
+	(
+		list__member(_ - SubGoalInfo, GoalList),
+		\+ goal_info_is_pure(SubGoalInfo)
+	->
+ 		list__map(get_purity, GoalList, _PurityList),
+ 		GoalInfo = GoalInfo0
+	;
+ 		GoalInfo = GoalInfo0
+	),
+	Goal = hlds_goal_expr - GoalInfo,
+	proc_info_set_body(Goal, Proc).
+
+:- pred proc_info_set_body(hlds_goal::in, proc_info::out)  is det.
+
+proc_info_set_body(_, proc_info).
+
+:- pred get_purity(hlds_goal::in, purity::out) is det.
+
+get_purity(_, pure).
+
+:- pred goal_info_is_pure(hlds_goal_info::in) is semidet.
+
+goal_info_is_pure(hlds_goal_info) :- semidet_fail.
+
+:- func worst_purity(purity, purity) = purity.
+
+worst_purity(_, _) = pure.

--------------------------------------------------------------------------
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