diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-10-21 20:12:52 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-10-21 20:12:52 +0000 |
commit | c0c7206d89c1d73f5253415d7a8958f932f62e2b (patch) | |
tree | 4f368862290e2b5e79a8d920c685df20c5d2c9de /libgfortran/m4 | |
parent | 7d4074339038e21d9bfc7656b5ed8db4b5c57f01 (diff) | |
download | gcc-c0c7206d89c1d73f5253415d7a8958f932f62e2b.zip gcc-c0c7206d89c1d73f5253415d7a8958f932f62e2b.tar.gz gcc-c0c7206d89c1d73f5253415d7a8958f932f62e2b.tar.bz2 |
re PR libfortran/34670 (bounds checking for array intrinsics)
2008-10-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34670
* intrinsics/transpose_generic.c: Implement bounds checking.
* m4/transpose.m4: Likewise.
* generated/transpose_c8.c: Regenerated.
* generated/transpose_c16.c: Regenerated.
* generated/transpose_r10.c: Regenerated.
* generated/transpose_i8.c: Regenerated.
* generated/transpose_c10.c: Regenerated.
* generated/transpose_r4.c: Regenerated.
* generated/transpose_c4.c: Regenerated.
* generated/transpose_i16.c: Regenerated.
* generated/transpose_i4.c: Regenerated.
* generated/transpose_r8.c: Regenerated.
* generated/transpose_r16.c: Regenerated.
2008-10-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34670
* gfortran.dg/transpose_2.f90: New test.
From-SVN: r141276
Diffstat (limited to 'libgfortran/m4')
-rw-r--r-- | libgfortran/m4/transpose.m4 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4 index 103cc02..de543ee 100644 --- a/libgfortran/m4/transpose.m4 +++ b/libgfortran/m4/transpose.m4 @@ -70,6 +70,28 @@ transpose_'rtype_code` ('rtype` * const restrict ret, ret->data = internal_malloc_size (sizeof ('rtype_name`) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; |