+2022-02-11 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * gfortran.h (is_omp_declarative_stmt): New.
+ * openmp.c (match_omp_metadirective): Reject declarative OpenMP
+ directives with 'sorry'.
+ * parse.c (parse_omp_metadirective_body): Check that state stack head
+ is non-null before dereferencing.
+ (is_omp_declarative_stmt): New.
+
2022-02-11 Kwok Cheung Yeung <kcy@codesourcery.com>
* decl.c (gfc_match_end): Search for first previous state that is not
void gfc_global_used (gfc_gsymbol *, locus *);
gfc_namespace* gfc_build_block_ns (gfc_namespace *);
gfc_statement match_omp_directive (void);
+bool is_omp_declarative_stmt (gfc_statement);
/* dependency.c */
int gfc_dep_compare_functions (gfc_expr *, gfc_expr *, bool);
gfc_statement directive = match_omp_directive ();
gfc_matching_omp_context_selector = false;
+ if (is_omp_declarative_stmt (directive))
+ sorry ("declarative directive variants are not supported");
+
if (gfc_error_flag_test ())
{
gfc_current_locus = old_loc;
gfc_in_metadirective_body = old_in_metadirective_body;
- *clause->code = *gfc_state_stack->head;
+ if (gfc_state_stack->head)
+ *clause->code = *gfc_state_stack->head;
pop_state ();
gfc_commit_symbols ();
return false;
}
}
+
+/* Return true if ST is a declarative OpenMP statement. */
+bool
+is_omp_declarative_stmt (gfc_statement st)
+{
+ switch (st)
+ {
+ case_omp_decl:
+ return true;
+ default:
+ return false;
+ }
+}
+2022-02-11 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * gfortran.dg/gomp/metadirective-2.f90 (main): Test empty
+ metadirective.
+
2022-02-11 Kwok Cheung Yeung <kcy@codesourcery.com>
* gfortran.dg/gomp/metadirective-8.f90: New.
end do
!$omp end metadirective
- ! Test labels in the body
+ ! Test labels in the body.
!$omp begin metadirective &
!$omp& when (device={arch("nvptx")}: parallel do) &
!$omp& when (device={arch("gcn")}: parallel)
20 continue
end do
!$omp end metadirective
+
+ ! Test empty metadirective.
+ !$omp metadirective
end program