bug fix for arg/3 and argument/3
Fergus Henderson
fjh at cs.mu.oz.au
Sat Apr 26 18:20:49 AEST 1997
Estimated hours taken: 0.5
library/std_util.m:
Fix a bug in Tyson's change from `arg' (1-based) to `argument'
(0-based) -- he hadn't changed the pragma c_code for `argument'
to assume the argument passed was 0-based.
Index: std_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/std_util.m,v
retrieving revision 1.79
diff -u -r1.79 std_util.m
--- std_util.m 1997/04/23 06:37:33 1.79
+++ std_util.m 1997/04/24 01:49:56
@@ -2043,12 +2043,12 @@
restore_transient_registers();
/* Check range */
- success = (ArgumentIndex > 0 && ArgumentIndex <= info.arity);
+ success = (ArgumentIndex >= 0 && ArgumentIndex < info.arity);
if (success) {
/* Allocate enough room for a univ */
incr_hp(Argument, 2);
- arg_pseudo_type_info = info.type_info_vector[ArgumentIndex - 1];
+ arg_pseudo_type_info = info.type_info_vector[ArgumentIndex];
if (arg_pseudo_type_info < TYPELAYOUT_MAX_VARINT) {
field(0, Argument, UNIV_OFFSET_FOR_TYPEINFO) =
((Word *) TypeInfo_for_T)[arg_pseudo_type_info];
@@ -2058,7 +2058,7 @@
arg_pseudo_type_info;
}
field(0, Argument, UNIV_OFFSET_FOR_DATA) =
- info.argument_vector[ArgumentIndex - 1];
+ info.argument_vector[ArgumentIndex];
}
/* Free the allocated type_info_vector, since we just copied
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list