This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb/users/hjl/linux/master] gdb/guile: Do not error when trying to create empty array.
- From: H.J.Lu <hjl at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 11 Jan 2015 16:19:59 -0000
- Subject: [binutils-gdb/users/hjl/linux/master] gdb/guile: Do not error when trying to create empty array.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fce10a8494efa8faec67b718f25e06d3d71694b3
commit fce10a8494efa8faec67b718f25e06d3d71694b3
Author: Joel Brobecker <brobecker@adacore.com>
Date: Tue Jan 6 18:37:53 2015 +0400
gdb/guile: Do not error when trying to create empty array.
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.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/guile/scm-type.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a6211bf..8e3737d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 92d5328..4f46139 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -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),