re PR libfortran/27524 (-fbounds-check interacts with array function)

PR fortran/27524

	* trans-array.c (gfc_trans_dummy_array_bias): Don't use stride as
	a temporary variable when -fbounds-check is enabled, since its
	value will be needed later.

	* gfortran.dg/bounds_check_1.f90: New test.

From-SVN: r114142
This commit is contained in:
Francois-Xavier Coudert 2006-05-26 23:18:45 +02:00 committed by François-Xavier Coudert
parent 7c7ce73aa7
commit e8300d6eaf
4 changed files with 27 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2006-05-26 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/27524
* trans-array.c (gfc_trans_dummy_array_bias): Don't use stride as
a temporary variable when -fbounds-check is enabled, since its
value will be needed later.
2006-05-26 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/23151

View file

@ -3564,7 +3564,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
tree dumdesc;
tree tmp;
tree stmt;
tree stride;
tree stride, stride2;
tree stmt_packed;
tree stmt_unpacked;
tree partial;
@ -3711,9 +3711,9 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
ubound, lbound);
stride = build2 (MINUS_EXPR, gfc_array_index_type,
stride2 = build2 (MINUS_EXPR, gfc_array_index_type,
dubound, dlbound);
tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride);
tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2);
gfc_trans_runtime_check (tmp, gfc_strconst_bounds, &block);
}
}

View file

@ -1,3 +1,8 @@
2006-05-26 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/27524
* gfortran.dg/bounds_check_1.f90: New test.
2006-05-26 Ulrich Weigand <uweigand@de.ibm.com>
PR rtl-optimization/27661

View file

@ -0,0 +1,12 @@
! { dg-do run }
! { dg-options "-fbounds-check" }
! PR fortran/27524
integer :: res(1)
res = F()
if (res(1) /= 1) call abort
contains
function F()
integer :: F(1)
f = 1
end function F
end