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/intrinsics | |
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/intrinsics')
-rw-r--r-- | libgfortran/intrinsics/reshape_generic.c | 9 |
1 files changed, 8 insertions, 1 deletions
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" |