Hi! We reject the statement later on, because it is not allowed in block data, but if we stick it into the block data ns anyway, we ICE later on during diagnostics.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk, queued for 6.2. 2016-08-08 Jakub Jelinek <ja...@redhat.com> PR fortran/72716 * openmp.c (gfc_match_omp_declare_simd): Don't stick anything into BLOCK DATA ns, it will be rejected later. * gfortran.dg/gomp/pr72716.f90: New test. --- gcc/fortran/openmp.c.jj 2016-07-16 10:41:04.000000000 +0200 +++ gcc/fortran/openmp.c 2016-08-08 15:36:30.638892714 +0200 @@ -2000,6 +2000,12 @@ gfc_match_omp_declare_simd (void) false) != MATCH_YES) return MATCH_ERROR; + if (gfc_current_ns->is_block_data) + { + gfc_free_omp_clauses (c); + return MATCH_YES; + } + ods = gfc_get_omp_declare_simd (); ods->where = where; ods->proc_name = proc_name; --- gcc/testsuite/gfortran.dg/gomp/pr72716.f90.jj 2016-08-08 15:47:07.747170888 +0200 +++ gcc/testsuite/gfortran.dg/gomp/pr72716.f90 2016-08-08 15:48:50.036930905 +0200 @@ -0,0 +1,6 @@ +! PR fortran/72716 +! { dg-do compile } + +block data + !$omp declare simd (z) ! { dg-error "statement is not allowed inside of BLOCK DATA" } +end block data Jakub