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

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Nov 19 02:19:52 AEDT 2000


On 18-Nov-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 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).

The same code, with the same problem, was also in one of the test
cases.

Estimated hours taken: 0.25

tests/hard_coded/lp.m:
	Change some code so that a division is executed only *after*
	checking that the divisor is non-zero.

Workspace: /home/mercury0/fjh/mercury
Index: tests/hard_coded/lp.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/lp.m,v
retrieving revision 1.1
diff -u -d -r1.1 lp.m
--- tests/hard_coded/lp.m	1998/10/01 07:10:11	1.1
+++ tests/hard_coded/lp.m	2000/11/18 15:06:05
@@ -263,8 +263,11 @@
 				Max0 = yes(_ - MaxVal0),
 				index(A0, N, M, Row, Q, CellVal),
 				index(A0, N, M, Row, M, 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