------- Comment #18 from tkoenig at netcologne dot de 2010-08-10 09:19 ------- Subject: Re: Unnecessary temporaries
Am Dienstag, den 10.08.2010, 08:45 +0000 schrieb dominiq at lps dot ens dot fr: > I think that > > + identical_strides = gfc_dep_compare_expr (l_stride, r_stride) > == 1; > > should also be replaced with > > + identical_strides = gfc_dep_compare_expr (l_stride, r_stride) > == 0; Correct. Although it is probably better set the stride during resolution. Here's a tentative patch for that. There are probably very many places that NULL checks can be elided with this. Index: resolve.c =================================================================== --- resolve.c (Revision 163041) +++ resolve.c (Arbeitskopie) @@ -4378,12 +4378,19 @@ return FAILURE; } + /* Always fill in a stride of one. */ + + if (ar->dimen_type[i] == DIMEN_RANGE + && ar->stride[i] == NULL) + ar->stride[i] = gfc_get_int_expr (gfc_index_integer_kind, + &ar->where, 1); + /* Fill in the upper bound, which may be lower than the specified one for something like a(2:10:5), which is identical to a(2:7:5). Only relevant for strides not equal to one. */ if (ar->dimen_type[i] == DIMEN_RANGE - && ar->stride[i] != NULL && ar->stride[i]->expr_type == EXPR_CONSTANT + && ar->stride[i]->expr_type == EXPR_CONSTANT && mpz_cmp_si (ar->stride[i]->value.integer, 1L) != 0) { mpz_t size, end; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45159