[m-dev.] diff: fix bug in bytecode_data.m

Simon Taylor stayl at cs.mu.OZ.AU
Thu May 27 11:20:21 AEST 1999



Estimated hours taken: 0.1

compiler/bytecode_data.m:
	Fix a bug in checking whether a negative integer
	fits in a certain number of bits. There isn't a
	test case for this because the integer sizes less than
	a word are only ever used for positive numbers.



Index: bytecode_data.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/bytecode_data.m,v
retrieving revision 1.2
diff -u -u -r1.2 bytecode_data.m
--- bytecode_data.m	1999/03/10 00:01:42	1.2
+++ bytecode_data.m	1999/03/24 03:00:16
@@ -142,7 +142,10 @@
 	{ int__bits_per_int(IntBits) },
 	{ 
 		Bits < IntBits,
-		(IntVal /\ (\0 << Bits)) \= 0
+		int__pow(2, Bits, MaxVal),
+		( IntVal >= MaxVal
+		; IntVal < -MaxVal
+		)
 	->
 		string__format(
 		"error: bytecode_data__output_int: %d does not fit in %d bits",
--------------------------------------------------------------------------
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