[m-dev.] bug in simplification

Simon TAYLOR stayl at students.cs.mu.oz.au
Mon Feb 10 14:40:46 AEDT 1997


Hi Fergus,

> I just added a test case tests/valid/simplify_bug.m which breaks the
> current compiler.

This fixes the bug in simplify.m.

Simon.


Estimated hours taken: 0.5

compiler/simplify.m
	Fixed a bug where the code to wrap a some around nondet conjunctions
	with no outputs was not being run at -O-1.

tests/valid/Mmake
	Enabled simplify_bug.m.


Index: compiler/simplify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/simplify.m,v
retrieving revision 1.22
diff -u -r1.22 simplify.m
--- simplify.m	1997/02/08 16:16:01	1.22
+++ simplify.m	1997/02/10 03:30:48
@@ -107,18 +107,11 @@
 		ModuleInfo1 = ModuleInfo0,
 		State4 = State2
 	),
-	( simplify_do_excess_assigns(Info4) ->
 		% On the second pass do excess assignment elimination and
 		% some cleaning up after the common structure and branch 
 		% merging pass.
-		simplify__proc_2(Proc1, Proc, ModuleInfo1, ModuleInfo,
-			Info4, Info, State4, State5)
-	;
-		ModuleInfo = ModuleInfo1,
-		Proc = Proc0,
-		Info = Info4,
-		State5 = State4	
-	),
+	simplify__proc_2(Proc1, Proc, ModuleInfo1, ModuleInfo,
+			Info4, Info, State4, State5),
 	simplify_info_get_msgs(Info, Msgs2),
 	set__to_sorted_list(Msgs2, Msgs),
 	( simplify_do_warn(Info) ->
Index: tests/valid/Mmake
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/Mmake,v
retrieving revision 1.24
diff -u -r1.24 Mmake
--- Mmake	1996/12/11 00:03:02	1.24
+++ Mmake	1997/02/10 03:26:44
@@ -39,6 +39,7 @@
 	nondet_live.m \
 	semidet_disj.m \
 	shape_type.m \
+	simplify_bug.m \
 	stack_alloc.m \
 	switches.m \
 	same_length_2.m \
@@ -70,6 +71,11 @@
 two_way_unif.c: two_way_unif.m
 	$(MCG) --grade $(GRADE) $(MCGFLAGS) -O-1 two_way_unif.m \
 		> two_way_unif.err 2>&1
+
+# The bug simplify_bug.m tests for only occurred at -O-1
+simplify_bug.c:	simplify_bug.m
+	$(MCG) --grade $(GRADE) $(MCGFLAGS) -O-1 \
+		simplify_bug.m > simplify_bug.err 2>&1
 
 vn_float.c: vn_float.m
 	$(MCG) --grade $(GRADE) $(MCGFLAGS) -O5 vn_float.m > vn_float.err 2>&1



More information about the developers mailing list