[m-dev.] diff: fix bug(?) in lp.m

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 18 19:50:00 AEDT 2000


Estimated hours taken: 0.5

compiler/lp.m:
	Change some code so that a division is executed only *after*
	checking that the divisor is non-zero.  Without this change,
	the code crashed when doing a bootcheck in grade hlc.gc (in
	particular when doing termination analysis for library/array.m).

Workspace: /home/mercury0/fjh/mercury
Index: compiler/lp.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lp.m,v
retrieving revision 1.3
diff -u -d -r1.3 lp.m
--- compiler/lp.m	1998/01/23 12:56:43	1.3
+++ compiler/lp.m	2000/11/18 05:19:30
@@ -523,8 +523,11 @@
 				index(A0, Row, Q, CellVal),
 				rhs_col(A0, RHSC),
 				index(A0, Row, RHSC, MVal),
-				MaxVal1 is MVal/CellVal,
-				( CellVal > 0.0, MaxVal1 =< MaxVal0 ->
+				(
+					CellVal > 0.0,
+					MaxVal1 is MVal/CellVal,
+					MaxVal1 =< MaxVal0
+				->
 					Max = yes(Row - MaxVal1)
 				;
 					Max = Max0

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list