Skip to content

Commit 03e151f

Browse files
committed
initial commit
1 parent b518242 commit 03e151f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,14 @@ void AccAttributeVisitor::Post(
953953
const auto &clauseList = std::get<parser::AccClauseList>(x.t);
954954
for (const auto &clause : clauseList.v) {
955955
// Restriction - line 2414
956-
DoNotAllowAssumedSizedArray(GetAccObjectList(clause));
956+
// We assume the restriction is present because clauses that require
957+
// moving data would require the size of the data to be present, but
958+
// the deviceptr and present clauses do not require moving data and
959+
// thus we permit them.
960+
if (!std::holds_alternative<parser::AccClause::Deviceptr>(clause.u) &&
961+
!std::holds_alternative<parser::AccClause::Present>(clause.u)) {
962+
DoNotAllowAssumedSizedArray(GetAccObjectList(clause));
963+
}
957964
}
958965
}
959966

flang/test/Semantics/OpenACC/acc-declare-validity.f90

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,21 @@ end function fct1
6262
subroutine sub2(cc)
6363
real(8), dimension(*) :: cc
6464
!ERROR: Assumed-size dummy arrays may not appear on the DECLARE directive
65-
!$acc declare present(cc)
65+
!$acc declare copyin(cc)
6666
end subroutine sub2
6767

68+
subroutine sub2e1(cc)
69+
real(8), dimension(*) :: cc
70+
!OK
71+
!$acc declare present(cc)
72+
end subroutine sub2e1
73+
74+
subroutine sub2e2(cc)
75+
real(8), dimension(*) :: cc
76+
!OK
77+
!$acc declare deviceptr(cc)
78+
end subroutine sub2e2
79+
6880
subroutine sub3()
6981
real :: aa(100)
7082
!ERROR: The ZERO modifier is not allowed for the COPYOUT clause on the DECLARE directive

0 commit comments

Comments
 (0)