This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,commited] Don't perform bounds-checking on assumed-size arrays


FX Coudert wrote:
I just reviewed and commited Andrew's patch for PR fortran/19777 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19777), proposed on bugzilla. It's a simple one-line that disables bounds-checking when accessing elements of a assumed-size array:

--- trunk/gcc/fortran/trans-array.c 2006/05/27 09:06:01 114152
+++ trunk/gcc/fortran/trans-array.c 2006/05/27 09:41:42 114153
@@ -1948,7 +1948,7 @@
gfc_conv_expr_type (&indexse, ar->start[n], gfc_array_index_type);
gfc_add_block_to_block (&se->pre, &indexse.pre);


-      if (flag_bounds_check)
+      if (flag_bounds_check && ar->as->type != AS_ASSUMED_SIZE)
	{
	  /* Check array bounds.  */
	  tree cond;

This doesn't do any bounds checking at all for an assumed-size array, however, while all but the last exponent of an assumed-size array should in theory be checkable. Would making the check


      if (flag_bounds_check && (ar->as->type != AS_ASSUMED_SIZE
        || n < ar->dimen - 1))

work correctly for checking the lower dimensions?

- Brooks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]