2016-08-19 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/71014
+ * resolve.c (gfc_resolve): For ns->construct_entities don't save, clear
+ and restore omp state around the resolving.
+
PR fortran/69281
* trans-openmp.c (gfc_trans_omp_parallel, gfc_trans_omp_task,
gfc_trans_omp_target): Wrap gfc_trans_omp_code result in an extra
/* As gfc_resolve can be called during resolution of an OpenMP construct
body, we should clear any state associated to it, so that say NS's
DO loops are not interpreted as OpenMP loops. */
- gfc_omp_save_and_clear_state (&old_omp_state);
+ if (!ns->construct_entities)
+ gfc_omp_save_and_clear_state (&old_omp_state);
resolve_types (ns);
component_assignment_level = 0;
gfc_run_passes (ns);
- gfc_omp_restore_state (&old_omp_state);
+ if (!ns->construct_entities)
+ gfc_omp_restore_state (&old_omp_state);
}
+2016-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/71014
+ * testsuite/libgomp.fortran/pr71014.f90: New test.
+
2016-08-18 Chung-Lin Tang <cltang@codesourcery.com>
PR middle-end/70895
--- /dev/null
+! PR fortran/71014
+! { dg-do run }
+! { dg-additional-options "-O0" }
+
+program pr71014
+ implicit none
+ integer :: i, j
+ integer, parameter :: t = 100*101/2
+ integer :: s(16)
+ s(:) = 0
+!$omp parallel do
+ do j = 1, 16
+ associate (k => j)
+ do i = 1, 100
+ s(j) = s(j) + i
+ end do
+ end associate
+ end do
+ if (any(s /= t)) call abort
+end program pr71014