This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libgfortran/62188, committed] Fix indexing off end of array


I've committed this patch as obvious to trunk and the 4.8
4.9 branches.

2014-08-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR libgfortran/62188
	* m4/bessel.m4: Avoid indexing off the end of an array.
	* generated/bessel_r10.c: Regenerated.
	* generated/bessel_r16.c: Ditto.
	* generated/bessel_r4.c: Ditto.
	* generated/bessel_r8.c: Ditto.

-- 
Steve

Index: generated/bessel_r10.c
===================================================================
--- generated/bessel_r10.c	(revision 214227)
+++ generated/bessel_r10.c	(working copy)
@@ -162,7 +162,7 @@ bessel_yn_r10 (gfc_array_r10 * const res
 
   x2rev = GFC_REAL_10_LITERAL(2.)/x;
 
-  for (i = 2; i <= n1+n2; i++)
+  for (i = 2; i <= n2 - n1; i++)
     {
 #if defined(GFC_REAL_10_INFINITY)
       if (unlikely (last2 == -GFC_REAL_10_INFINITY))
Index: generated/bessel_r16.c
===================================================================
--- generated/bessel_r16.c	(revision 214227)
+++ generated/bessel_r16.c	(working copy)
@@ -166,7 +166,7 @@ bessel_yn_r16 (gfc_array_r16 * const res
 
   x2rev = GFC_REAL_16_LITERAL(2.)/x;
 
-  for (i = 2; i <= n1+n2; i++)
+  for (i = 2; i <= n2 - n1; i++)
     {
 #if defined(GFC_REAL_16_INFINITY)
       if (unlikely (last2 == -GFC_REAL_16_INFINITY))
Index: generated/bessel_r4.c
===================================================================
--- generated/bessel_r4.c	(revision 214227)
+++ generated/bessel_r4.c	(working copy)
@@ -162,7 +162,7 @@ bessel_yn_r4 (gfc_array_r4 * const restr
 
   x2rev = GFC_REAL_4_LITERAL(2.)/x;
 
-  for (i = 2; i <= n1+n2; i++)
+  for (i = 2; i <= n2 - n1; i++)
     {
 #if defined(GFC_REAL_4_INFINITY)
       if (unlikely (last2 == -GFC_REAL_4_INFINITY))
Index: generated/bessel_r8.c
===================================================================
--- generated/bessel_r8.c	(revision 214227)
+++ generated/bessel_r8.c	(working copy)
@@ -162,7 +162,7 @@ bessel_yn_r8 (gfc_array_r8 * const restr
 
   x2rev = GFC_REAL_8_LITERAL(2.)/x;
 
-  for (i = 2; i <= n1+n2; i++)
+  for (i = 2; i <= n2 - n1; i++)
     {
 #if defined(GFC_REAL_8_INFINITY)
       if (unlikely (last2 == -GFC_REAL_8_INFINITY))
Index: m4/bessel.m4
===================================================================
--- m4/bessel.m4	(revision 214227)
+++ m4/bessel.m4	(working copy)
@@ -163,7 +163,7 @@ bessel_yn_r'rtype_kind` ('rtype` * const
 
   x2rev = GFC_REAL_'rtype_kind`_LITERAL(2.)/x;
 
-  for (i = 2; i <= n1+n2; i++)
+  for (i = 2; i <= n2 - n1; i++)
     {
 #if defined('rtype_name`_INFINITY)
       if (unlikely (last2 == -'rtype_name`_INFINITY))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]