Fix `aligned(argument-list[ : alignment])` for `declare simd`
(original implementation will throw parser error if `: alignment` is present.
Original-commit: flang-compiler/f18@
f3f50f9ad3b77174d0054011a17c8e4d3af50d98
Reviewed-on: https://github.com/flang-compiler/f18/pull/669
// ALIGNED(list: alignment)
TYPE_PARSER(construct<OmpAlignedClause>(
- nonemptyList(name), maybe(":"_tok) >> scalarIntConstantExpr))
+ nonemptyList(name), maybe(":" >> scalarIntConstantExpr)))
TYPE_PARSER(construct<OmpObject>(pure(OmpObject::Kind::Object), designator) ||
construct<OmpObject>(
void OmpStructureChecker::Enter(const parser::OpenMPDeclareSimdConstruct &x) {
const auto &dir{std::get<parser::Verbatim>(x.t)};
PushContext(dir.source, OmpDirective::DECLARE_SIMD);
+ // 2.8.2 declare-simd-clause -> simdlen-clause |
+ // linear-clause |
+ // aligned-clause |
+ // uniform-clause |
+ // inbranch-clause |
+ // notinbranch-clause
+ OmpClauseSet allowed{OmpClause::LINEAR, OmpClause::ALIGNED,
+ OmpClause::UNIFORM, OmpClause::INBRANCH, OmpClause::NOTINBRANCH};
+ SetContextAllowed(allowed);
+ SetContextAllowedOnce({OmpClause::SIMDLEN});
}
void OmpStructureChecker::Leave(const parser::OpenMPDeclareSimdConstruct &) {
subroutine declare_simd_1(a, b)
real(8), intent(inout) :: a, b
!ERROR: Internal: no symbol found for 'declare_simd_1'
- !$omp declare simd(declare_simd_1)
+ !ERROR: Internal: no symbol found for 'a'
+ !$omp declare simd(declare_simd_1) aligned(a)
a = 3.14 + b
end subroutine declare_simd_1