diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-22 21:41:27 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-22 21:41:27 +0000 |
commit | aeef03892d6f2b83ba14d8afdb990a52c9d73438 (patch) | |
tree | 6eef96808a54ab0bd4ddf78411a3d8f3000cd141 /libgfortran | |
parent | 209d3778a7ecf0614943c5be9263d89dfb76e80c (diff) | |
download | gcc-aeef03892d6f2b83ba14d8afdb990a52c9d73438.tar.gz |
2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/38225
* intrinsics/reshape_generic.c (reshape_internal):
Use all dimensions of source for bounds checking.
* m4/reshape.m4: Likewise.
* generated/reshape_c10.c Regenerated.
* generated/reshape_c16.c Regenerated.
* generated/reshape_c4.c Regenerated.
* generated/reshape_c8.c Regenerated.
* generated/reshape_i16.c Regenerated.
* generated/reshape_i4.c Regenerated.
* generated/reshape_i8.c Regenerated.
* generated/reshape_r10.c Regenerated.
* generated/reshape_r16.c Regenerated.
* generated/reshape_r4.c Regenerated.
* generated/reshape_r8.c Regenerated.
2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/38225
* gfortran.dg/reshape_3.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142125 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 18 | ||||
-rw-r--r-- | libgfortran/generated/reshape_c10.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_c16.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_c4.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_c8.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_i16.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_i4.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_i8.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_r10.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_r16.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_r4.c | 9 | ||||
-rw-r--r-- | libgfortran/generated/reshape_r8.c | 9 | ||||
-rw-r--r-- | libgfortran/intrinsics/reshape_generic.c | 9 | ||||
-rw-r--r-- | libgfortran/m4/reshape.m4 | 9 |
14 files changed, 122 insertions, 13 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f2d279db20c..7a176ee10e6 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,21 @@ +2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/38225 + * intrinsics/reshape_generic.c (reshape_internal): + Use all dimensions of source for bounds checking. + * m4/reshape.m4: Likewise. + * generated/reshape_c10.c Regenerated. + * generated/reshape_c16.c Regenerated. + * generated/reshape_c4.c Regenerated. + * generated/reshape_c8.c Regenerated. + * generated/reshape_i16.c Regenerated. + * generated/reshape_i4.c Regenerated. + * generated/reshape_i8.c Regenerated. + * generated/reshape_r10.c Regenerated. + * generated/reshape_r16.c Regenerated. + * generated/reshape_r4.c Regenerated. + * generated/reshape_r8.c Regenerated. + 2008-11-22 Jakub Jelinek <jakub@redhat.com> PR libfortran/37839 diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 076ea592130..33059948a64 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -135,7 +135,14 @@ reshape_c10 (gfc_array_c10 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index 968fb9c34ce..3b026a5028b 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -135,7 +135,14 @@ reshape_c16 (gfc_array_c16 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index 00c95e7787c..1c4740c7f0b 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -135,7 +135,14 @@ reshape_c4 (gfc_array_c4 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index 9d355a51370..d68ea481ad3 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -135,7 +135,14 @@ reshape_c8 (gfc_array_c8 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index 28885115569..f46d7586dfc 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -135,7 +135,14 @@ reshape_16 (gfc_array_i16 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 021ecfbc314..d868c936cc2 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -135,7 +135,14 @@ reshape_4 (gfc_array_i4 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index 9a2ce8d45dd..bcd984f1397 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -135,7 +135,14 @@ reshape_8 (gfc_array_i8 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index 100173f70d0..ac029593d98 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -135,7 +135,14 @@ reshape_r10 (gfc_array_r10 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index 8a344e0b6ba..c12fab5c399 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -135,7 +135,14 @@ reshape_r16 (gfc_array_r16 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index ea8c24a2b66..aa4bdec70d4 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -135,7 +135,14 @@ reshape_r4 (gfc_array_r4 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index d8855e7874e..bacaaac05bc 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -135,7 +135,14 @@ reshape_r8 (gfc_array_r8 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c index 04b87271e9b..8e1fedb7a99 100644 --- a/libgfortran/intrinsics/reshape_generic.c +++ b/libgfortran/intrinsics/reshape_generic.c @@ -124,7 +124,14 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4 index b7e321e3bb4..aa5d42960f7 100644 --- a/libgfortran/m4/reshape.m4 +++ b/libgfortran/m4/reshape.m4 @@ -139,7 +139,14 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } if (rs < source_extent || (rs > source_extent && !pad)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" |