gdb/guile: Do not error when trying to create empty array.
authorJoel Brobecker <brobecker@adacore.com>
Tue, 6 Jan 2015 14:37:53 +0000 (18:37 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 6 Jan 2015 15:09:54 +0000 (19:09 +0400)
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.

gdb/ChangeLog
gdb/guile/scm-type.c

index a6211bf3fa588834d390f284eb57061e95c46ca4..8e3737dfc45bf4731761b622ba81b377611eb2b3 100644 (file)
@@ -1,3 +1,8 @@
+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
index 92d5328c44c552168a27125b3922263f28ed0489..4f46139241f8483dc509ebac533c7db0246a3045 100644 (file)
@@ -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),
This page took 0.030378 seconds and 4 git commands to generate.