In ECL 12.2.1, there are several calls to FEtype_error_index that pass
a cl_object as the second argument instead of a cl_fixnum. I'm not
totally sure of the best way to solve this in all cases, but the
attached patch is one attempt.
Regards,
--
Jerry James
http://www.jamezone.org/
diff --git a/src/c/array.d b/src/c/array.d
index be9f330..d8e91dd 100644
--- a/src/c/array.d
+++ b/src/c/array.d
@@ -99,13 +99,11 @@ ecl_to_index(cl_object n)
case t_fixnum: {
cl_fixnum out = fix(n);
if (out < 0 || out >= ADIMLIM)
- FEtype_error_index(Cnil, n);
+ FEtype_error_index(Cnil, out);
return out;
}
- case t_bignum:
- FEtype_error_index(Cnil, n);
default:
- FEwrong_type_only_arg(@[coerce], n, @[integer]);
+ FEwrong_type_only_arg(@[coerce], n, @[fixnum]);
}
}
diff --git a/src/c/instance.d b/src/c/instance.d
index e433153..ae19466 100644
--- a/src/c/instance.d
+++ b/src/c/instance.d
@@ -90,9 +90,11 @@ si_instance_ref(cl_object x, cl_object index)
if (ecl_unlikely(!ECL_INSTANCEP(x)))
FEwrong_type_nth_arg(@[si::instance-ref], 1, x, @[ext::instance]);
- if (ecl_unlikely(!FIXNUMP(index) ||
- (i = fix(index)) < 0 || i >= (cl_fixnum)x->instance.length))
- FEtype_error_index(x, index);
+ if (ecl_unlikely(!FIXNUMP(index)))
+ FEwrong_type_nth_arg(@[si::instance-ref], 2, index, @[fixnum]);
+ i = fix(index);
+ if (ecl_unlikely(i < 0 || i >= (cl_fixnum)x->instance.length))
+ FEtype_error_index(x, i);
@(return x->instance.slots[i])
}
@@ -103,9 +105,11 @@ si_instance_ref_safe(cl_object x, cl_object index)
if (ecl_unlikely(!ECL_INSTANCEP(x)))
FEwrong_type_nth_arg(@[si::instance-ref], 1, x, @[ext::instance]);
- if (ecl_unlikely(!FIXNUMP(index) ||
- (i = fix(index)) < 0 || i >= x->instance.length))
- FEtype_error_index(x, index);
+ if (ecl_unlikely(!FIXNUMP(index)))
+ FEwrong_type_nth_arg(@[si::instance-ref], 2, index, @[fixnum]);
+ i = fix(index);
+ if (ecl_unlikely(i < 0 || i >= x->instance.length))
+ FEtype_error_index(x, i);
x = x->instance.slots[i];
if (ecl_unlikely(x == ECL_UNBOUND))
cl_error(5, @'unbound-slot', @':name', index, @':instance', x);
@@ -130,9 +134,11 @@ si_instance_set(cl_object x, cl_object index, cl_object value)
if (ecl_unlikely(!ECL_INSTANCEP(x)))
FEwrong_type_nth_arg(@[si::instance-set], 1, x, @[ext::instance]);
- if (ecl_unlikely(!FIXNUMP(index) ||
- (i = fix(index)) >= (cl_fixnum)x->instance.length || i < 0))
- FEtype_error_index(x, index);
+ if (ecl_unlikely(!FIXNUMP(index)))
+ FEwrong_type_nth_arg(@[si::instance-set], 2, index, @[fixnum]);
+ i = fix(index);
+ if (ecl_unlikely(i >= (cl_fixnum)x->instance.length || i < 0))
+ FEtype_error_index(x, i);
x->instance.slots[i] = value;
@(return value)
}
@@ -164,9 +170,11 @@ si_sl_makunbound(cl_object x, cl_object index)
if (ecl_unlikely(!ECL_INSTANCEP(x)))
FEwrong_type_nth_arg(@[si::sl-makunbound], 1, x, @[ext::instance]);
- if (ecl_unlikely(!FIXNUMP(index) ||
- (i = fix(index)) >= x->instance.length || i < 0))
- FEtype_error_index(x, index);
+ if (ecl_unlikely(!FIXNUMP(index)))
+ FEwrong_type_nth_arg(@[si::sl-makunbound], 2, index, @[fixnum]);
+ i = fix(index);
+ if (ecl_unlikely((i >= x->instance.length || i < 0))
+ FEtype_error_index(x, i);
x->instance.slots[i] = ECL_UNBOUND;
@(return x)
}
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list