X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=libgfortran%2Fgenerated%2Fmaxloc0_8_i1.c;h=f20eda20ac883e46b203204110b43b521785329e;hp=916e4dcb1a254303e9f89d22efe6fed8d4c14766;hb=c7fb575fcdd6cf39f07d823264a4709454d35050;hpb=7ed8f627fe8113910f550f6eda57600a217eaf42 diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index 916e4dcb1a2..f20eda20ac8 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -1,5 +1,5 @@ /* Implementation of the MAXLOC intrinsic - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2007 Free Software Foundation, Inc. Contributed by Paul Brook This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -28,11 +28,10 @@ License along with libgfortran; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "config.h" +#include "libgfortran.h" #include #include #include -#include "libgfortran.h" #if defined (HAVE_GFC_INTEGER_1) && defined (HAVE_GFC_INTEGER_8) @@ -51,7 +50,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, index_type sstride[GFC_MAX_DIMENSIONS]; index_type dstride; const GFC_INTEGER_1 *base; - GFC_INTEGER_8 *dest; + GFC_INTEGER_8 * restrict dest; index_type rank; index_type n; @@ -70,11 +69,22 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, } else { - if (GFC_DESCRIPTOR_RANK (retarray) != 1) - runtime_error ("rank of return array does not equal 1"); - - if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank) - runtime_error ("dimension of return array incorrect"); + if (unlikely (compile_options.bounds_check)) + { + int ret_rank; + index_type ret_extent; + + ret_rank = GFC_DESCRIPTOR_RANK (retarray); + if (ret_rank != 1) + runtime_error ("rank of return array in MAXLOC intrinsic" + " should be 1, is %ld", (long int) ret_rank); + + ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + if (ret_extent != rank) + runtime_error ("Incorrect extent in return value of" + " MAXLOC intrnisic: is %ld, should be %ld", + (long int) ret_extent, (long int) rank); + } } dstride = retarray->dim[0].stride; @@ -183,11 +193,41 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, } else { - if (GFC_DESCRIPTOR_RANK (retarray) != 1) - runtime_error ("rank of return array does not equal 1"); - - if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank) - runtime_error ("dimension of return array incorrect"); + if (unlikely (compile_options.bounds_check)) + { + int ret_rank, mask_rank; + index_type ret_extent; + int n; + index_type array_extent, mask_extent; + + ret_rank = GFC_DESCRIPTOR_RANK (retarray); + if (ret_rank != 1) + runtime_error ("rank of return array in MAXLOC intrinsic" + " should be 1, is %ld", (long int) ret_rank); + + ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + if (ret_extent != rank) + runtime_error ("Incorrect extent in return value of" + " MAXLOC intrnisic: is %ld, should be %ld", + (long int) ret_extent, (long int) rank); + + mask_rank = GFC_DESCRIPTOR_RANK (mask); + if (rank != mask_rank) + runtime_error ("rank of MASK argument in MAXLOC intrnisic" + "should be %ld, is %ld", (long int) rank, + (long int) mask_rank); + + for (n=0; ndim[n].ubound + 1 - array->dim[n].lbound; + mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + if (array_extent != mask_extent) + runtime_error ("Incorrect extent in MASK argument of" + " MAXLOC intrinsic in dimension %ld:" + " is %ld, should be %ld", (long int) n + 1, + (long int) mask_extent, (long int) array_extent); + } + } } mask_kind = GFC_DESCRIPTOR_SIZE (mask); @@ -313,11 +353,20 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, } else { - if (GFC_DESCRIPTOR_RANK (retarray) != 1) - runtime_error ("rank of return array does not equal 1"); + if (unlikely (compile_options.bounds_check)) + { + int ret_rank; + index_type ret_extent; + + ret_rank = GFC_DESCRIPTOR_RANK (retarray); + if (ret_rank != 1) + runtime_error ("rank of return array in MAXLOC intrinsic" + " should be 1, is %ld", (long int) ret_rank); - if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank) - runtime_error ("dimension of return array incorrect"); + ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + if (ret_extent != rank) + runtime_error ("dimension of return array incorrect"); + } } dstride = retarray->dim[0].stride;