From d1bbccf1d565b47529e9eb5b70fe1836a4a747bb Mon Sep 17 00:00:00 2001 From: Jinxin Yang Date: Thu, 5 Sep 2019 09:09:01 -0700 Subject: [PATCH] [flang] [OpenMP] update `declare simd` directive with exclusive set Original-commit: flang-compiler/f18@dc1bd8edc6968f8505429a9cba5db707c2d647d8 --- flang/lib/semantics/check-omp-structure.cc | 5 +++-- flang/test/semantics/omp-declarative-directive.f90 | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flang/lib/semantics/check-omp-structure.cc b/flang/lib/semantics/check-omp-structure.cc index cb058ac3187f..8ef18cfeadec 100644 --- a/flang/lib/semantics/check-omp-structure.cc +++ b/flang/lib/semantics/check-omp-structure.cc @@ -416,10 +416,11 @@ void OmpStructureChecker::Enter(const parser::OpenMPDeclareSimdConstruct &x) { // uniform-clause | // inbranch-clause | // notinbranch-clause - OmpClauseSet allowed{OmpClause::LINEAR, OmpClause::ALIGNED, - OmpClause::UNIFORM, OmpClause::INBRANCH, OmpClause::NOTINBRANCH}; + OmpClauseSet allowed{ + OmpClause::LINEAR, OmpClause::ALIGNED, OmpClause::UNIFORM}; SetContextAllowed(allowed); SetContextAllowedOnce({OmpClause::SIMDLEN}); + SetContextAllowedExclusive({OmpClause::INBRANCH, OmpClause::NOTINBRANCH}); } void OmpStructureChecker::Leave(const parser::OpenMPDeclareSimdConstruct &) { diff --git a/flang/test/semantics/omp-declarative-directive.f90 b/flang/test/semantics/omp-declarative-directive.f90 index a8cf5eac9a91..fbb870ab7b3d 100644 --- a/flang/test/semantics/omp-declarative-directive.f90 +++ b/flang/test/semantics/omp-declarative-directive.f90 @@ -42,7 +42,8 @@ subroutine declare_simd_2 use m1 procedure (sub) sub1 !ERROR: Internal: no symbol found for 'sub1' - !$omp declare simd(sub1) + !ERROR: NOTINBRANCH and INBRANCH are mutually exclusive and may not appear on the same DECLARE SIMD directive + !$omp declare simd(sub1) inbranch notinbranch procedure (sub), pointer::p p=>sub1 call p(5,10)