* [PATCH] Fix fortran/openmp.c collapsed loop analysis (PR fortran/85313)
@ 2018-04-10 14:07 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2018-04-10 14:07 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
Hi!
Dunno what I was thinking when adding this if (j < i) break;, with it we
never verify whether second and following loop iterators aren't used in
third and following loops in collapse(3) and above loops.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.
2018-04-10 Jakub Jelinek <jakub@redhat.com>
PR fortran/85313
* openmp.c (resolve_omp_do): Remove bogus if (j < i) break;.
(resolve_oacc_nested_loops): Likewise. Formatting fix.
* gfortran.dg/gomp/pr85313.f90: New test.
--- gcc/fortran/openmp.c.jj 2018-01-31 21:47:18.774155978 +0100
+++ gcc/fortran/openmp.c 2018-04-10 12:21:38.371945086 +0200
@@ -5600,8 +5600,6 @@ resolve_omp_do (gfc_code *code)
"iteration space at %L", name, &do_code->loc);
break;
}
- if (j < i)
- break;
do_code2 = do_code2->block->next;
}
}
@@ -5765,12 +5763,10 @@ resolve_oacc_nested_loops (gfc_code *cod
|| gfc_find_sym_in_expr (ivar, do_code->ext.iterator->end)
|| gfc_find_sym_in_expr (ivar, do_code->ext.iterator->step))
{
- gfc_error ("!$ACC LOOP %s loops don't form rectangular iteration space at %L",
- clause, &do_code->loc);
+ gfc_error ("!$ACC LOOP %s loops don't form rectangular "
+ "iteration space at %L", clause, &do_code->loc);
break;
}
- if (j < i)
- break;
do_code2 = do_code2->block->next;
}
}
--- gcc/testsuite/gfortran.dg/gomp/pr85313.f90.jj 2018-04-10 12:14:54.438779463 +0200
+++ gcc/testsuite/gfortran.dg/gomp/pr85313.f90 2018-04-10 12:13:46.975751804 +0200
@@ -0,0 +1,25 @@
+! PR fortran/85313
+! { dg-do compile }
+
+!$omp do collapse(3)
+ do i = 1, 10
+ do j = i, 20 ! { dg-error "form rectangular iteration space" }
+ do k = 1, 2
+ end do
+ end do
+ end do
+!$omp do collapse(3)
+ do i = 1, 10
+ do j = 1, 5
+ do k = i, 20 ! { dg-error "form rectangular iteration space" }
+ end do
+ end do
+ end do
+!$omp do collapse(3)
+ do i = 1, 10
+ do j = 1, 5
+ do k = j, 20 ! { dg-error "form rectangular iteration space" }
+ end do
+ end do
+ end do
+end
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-04-10 14:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 14:07 [PATCH] Fix fortran/openmp.c collapsed loop analysis (PR fortran/85313) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).