[gfortran,patch] Bounds-checking for lower bound of last dimension of assumed-size array

Tobias Burnus burnus@net-b.de
Mon May 14 14:19:00 GMT 2007


Hi François-Xavier,

François-Xavier Coudert wrote:
> Bootstrapped && regtested on i686-linux, both without and with
> -fbounds-check (no failure introduced by the patch, when running with
> -fbounds-check[1]). OK for mainline?
Bootstrapped and regression tested (x86_64-unknown-linux-gnu,
-m64/-m32). Also did some tests, which succeeded.

> Index: trans-array.c
> @@ -2090,7 +2093,9 @@ gfc_conv_array_index_offset (gfc_se * se
>  	  if ((ar->as->type != AS_ASSUMED_SIZE && !ar->as->cp_was_assumed)
>  	      || dim < ar->dimen - 1)
>  	    index = gfc_trans_array_bound_check (se, info->descriptor,
> -						 index, dim, &ar->where);
> +			index, dim, &ar->where,
> +			(ar->as->type != AS_ASSUMED_SIZE
> +			 && !ar->as->cp_was_assumed) || dim < ar->dimen - 1);
>   

Is not the last argument of gfc_trans_array_bound_check always true? You
copied exactly the arguments of the "if" above.

Did you want to remove the "if" completely?

> @@ -2116,7 +2121,9 @@ gfc_conv_array_index_offset (gfc_se * se
>  	  if ((ar->as->type != AS_ASSUMED_SIZE && !ar->as->cp_was_assumed)
>  	      || dim < ar->dimen - 1)
>  	    index = gfc_trans_array_bound_check (se, info->descriptor,
> -						 index, dim, &ar->where);
> +			index, dim, &ar->where,
> +			(ar->as->type != AS_ASSUMED_SIZE
> +			 && !ar->as->cp_was_assumed) || dim < ar->dimen - 1);
>   
Ditto.

Tobias



More information about the Fortran mailing list