[pushed/ob] gdb/guile: Do not error when trying to create empty array.
Commit Message
This fixes a similar error as in the Python support code where
trying to create an empty array.
In guile/scm-type.c::tyscm_array_1, the funtion raises an exception
if N2 < N1:
if (n2 < n1)
{
gdbscm_out_of_range_error (func_name, SCM_ARG3,
But it should be doing so if N2 == N1 - 1, since that would simply
be an empty array, not an array with a negative length.
gdb/ChangeLog:
* guile/scm-type.c (tyscm_array_1): Do not raise out-of-range
error if N2 is equal to N1 - 1.
No testcase, since I am not setup to build with Guile. Should be
trivial for anyone interested in adding one (see the tests I added
in gdb.python/py-type.exp as an example of what I added).
Pushed as obvious.
Thanks,
@@ -1,5 +1,10 @@
2015-01-06 Joel Brobecker <brobecker@adacore.com>
+ * guile/scm-type.c (tyscm_array_1): Do not raise out-of-range
+ error if N2 is equal to N1 - 1.
+
+2015-01-06 Joel Brobecker <brobecker@adacore.com>
+
* python/py-type.c (typy_array_1): Do not raise negative-length
exception if N2 is equal to N1 - 1.
@@ -713,7 +713,7 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
n1 = 0;
}
- if (n2 < n1)
+ if (n2 < n1 - 1)
{
gdbscm_out_of_range_error (func_name, SCM_ARG3,
scm_cons (scm_from_long (n1),