diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-11-22 21:41:27 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-11-22 21:41:27 +0000 |
commit | a388c77976fdac5a5773a9b71ee5f1644352a362 (patch) | |
tree | 6eef96808a54ab0bd4ddf78411a3d8f3000cd141 /libgfortran/generated | |
parent | 2ec855f1f74eb35dc8e2909b837ff7d8888d2220 (diff) | |
download | gcc-a388c77976fdac5a5773a9b71ee5f1644352a362.zip gcc-a388c77976fdac5a5773a9b71ee5f1644352a362.tar.gz gcc-a388c77976fdac5a5773a9b71ee5f1644352a362.tar.bz2 |
re PR libfortran/38225 (RESHAPE bounds with multi-dimensional SOURCE)
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.
From-SVN: r142125
Diffstat (limited to 'libgfortran/generated')
-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 |
11 files changed, 88 insertions, 11 deletions
diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 076ea59..3305994 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 968fb9c..3b026a5 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 00c95e7..1c4740c 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 9d355a5..d68ea48 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 2888511..f46d758 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 021ecfb..d868c93 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 9a2ce8d..bcd984f 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 100173f..ac02959 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 8a344e0b..c12fab5 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 ea8c24a..aa4bdec 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 d8855e7..bacaaac 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" |