------- Comment #5 from dominiq at lps dot ens dot fr 2010-08-06 22:49 ------- Note that the following patch I have in my tree for some time now also fix the pr
--- gcc/fortran/dependency.c 2010-08-07 00:37:34.000000000 +0200 +++ ../work/gcc/fortran/dependency.c 2010-08-05 19:11:58.000000000 +0200 @@ -1172,8 +1172,8 @@ check_section_vs_section (gfc_array_ref /* Check for forward dependencies x:y vs. x+1:z. */ if (l_dir == 1 && r_dir == 1 - && l_start && r_start && gfc_dep_compare_expr (l_start, r_start) == -1 - && l_end && r_end && gfc_dep_compare_expr (l_end, r_end) == -1) + && ((l_start && r_start && gfc_dep_compare_expr (l_start, r_start) == -1) + || (l_end && r_end && gfc_dep_compare_expr (l_end, r_end) == -1))) { /* Check that the strides are the same. */ if (!l_stride && !r_stride) @@ -1185,8 +1185,8 @@ check_section_vs_section (gfc_array_ref /* Check for forward dependencies x:y:-1 vs. x-1:z:-1. */ if (l_dir == -1 && r_dir == -1 - && l_start && r_start && gfc_dep_compare_expr (l_start, r_start) == 1 - && l_end && r_end && gfc_dep_compare_expr (l_end, r_end) == 1) + && ((l_start && r_start && gfc_dep_compare_expr (l_start, r_start) == 1) + || (l_end && r_end && gfc_dep_compare_expr (l_end, r_end) == 1))) { /* Check that the strides are the same. */ if (!l_stride && !r_stride) This followed a discussion with Tobias Burnus on IRC. It assumes that the code is valid, i.e., lhs and rhs has the same extent, otherwise creating a temporary does make the code valid, even if the result is not the same with or without temporary. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44235