[flang] Correct IsHostAssociated() to be true for BLOCK constructs

The predicate IsHostAssocited() was implemented in a way that would
return true only for cases of host association into a module or inner
subprogram.  Technically, the use of a name in a BLOCK construct
that is not declared therein is considered in the Fortran standard
to also be a form of host association, and this matters when doing
error checking on DATA statements.

Differential Revision: https://reviews.llvm.org/D130388
This commit is contained in:
Peter Klausler 2022-07-22 11:51:20 -07:00
parent ac8be21365
commit a9782fead3
30 changed files with 248 additions and 221 deletions

View File

@ -60,7 +60,8 @@ class Scope {
public:
ENUM_CLASS(Kind, Global, IntrinsicModules, Module, MainProgram, Subprogram,
BlockData, DerivedType, Block, Forall, ImpliedDos)
BlockData, DerivedType, BlockConstruct, Forall, OtherConstruct,
ImpliedDos)
using ImportKind = common::ImportKind;
// Create the Global scope -- the root of the scope tree

View File

@ -38,6 +38,8 @@ const Scope &GetTopLevelUnitContaining(const Scope &);
const Scope &GetTopLevelUnitContaining(const Symbol &);
const Scope &GetProgramUnitContaining(const Scope &);
const Scope &GetProgramUnitContaining(const Symbol &);
const Scope &GetProgramUnitOrBlockConstructContaining(const Scope &);
const Scope &GetProgramUnitOrBlockConstructContaining(const Symbol &);
const Scope *FindModuleContaining(const Scope &);
const Scope *FindModuleFileContaining(const Scope &);

View File

@ -821,7 +821,7 @@ static bool ProcessScopes(const Scope &scope,
case Scope::Kind::MainProgram:
case Scope::Kind::Subprogram:
case Scope::Kind::BlockData:
case Scope::Kind::Block: {
case Scope::Kind::BlockConstruct: {
std::list<std::list<SymbolRef>> associations{GetStorageAssociations(scope)};
for (const std::list<SymbolRef> &associated : associations) {
if (std::find_if(associated.begin(), associated.end(), [](SymbolRef ref) {

View File

@ -1301,7 +1301,7 @@ void AccVisitor::AddAccSourceRange(const parser::CharBlock &source) {
bool AccVisitor::Pre(const parser::OpenACCBlockConstruct &x) {
if (NeedsScope(x)) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
}
return true;
}
@ -1337,7 +1337,7 @@ public:
}
bool Pre(const parser::OpenMPLoopConstruct &) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
return true;
}
void Post(const parser::OpenMPLoopConstruct &) { PopScope(); }
@ -1357,7 +1357,7 @@ public:
}
bool Pre(const parser::OpenMPSectionsConstruct &) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
return true;
}
void Post(const parser::OpenMPSectionsConstruct &) { PopScope(); }
@ -1398,7 +1398,7 @@ void OmpVisitor::AddOmpSourceRange(const parser::CharBlock &source) {
bool OmpVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
if (NeedsScope(x)) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
}
return true;
}
@ -2202,7 +2202,8 @@ void ScopeHandler::PushScope(Scope::Kind kind, Symbol *symbol) {
void ScopeHandler::PushScope(Scope &scope) {
currScope_ = &scope;
auto kind{currScope_->kind()};
if (kind != Scope::Kind::Block) {
if (kind != Scope::Kind::BlockConstruct &&
kind != Scope::Kind::OtherConstruct) {
BeginScope(scope);
}
// The name of a module or submodule cannot be "used" in its scope,
@ -2520,7 +2521,7 @@ void ScopeHandler::NotePossibleBadForwardRef(const parser::Name &name) {
if (inSpecificationPart_ && name.symbol) {
auto kind{currScope().kind()};
if ((kind == Scope::Kind::Subprogram && !currScope().IsStmtFunction()) ||
kind == Scope::Kind::Block) {
kind == Scope::Kind::BlockConstruct) {
bool isHostAssociated{&name.symbol->owner() == &currScope()
? name.symbol->has<HostAssocDetails>()
: name.symbol->owner().Contains(currScope())};
@ -4150,7 +4151,7 @@ Symbol &DeclarationVisitor::HandleAttributeStmt(
// these can be set on a symbol that is host-assoc or use-assoc
if (!symbol &&
(currScope().kind() == Scope::Kind::Subprogram ||
currScope().kind() == Scope::Kind::Block)) {
currScope().kind() == Scope::Kind::BlockConstruct)) {
if (auto *hostSymbol{FindSymbol(name)}) {
symbol = &MakeHostAssocSymbol(name, *hostSymbol);
}
@ -4170,7 +4171,7 @@ Symbol &DeclarationVisitor::HandleAttributeStmt(
}
// C1107
bool DeclarationVisitor::CheckNotInBlock(const char *stmt) {
if (currScope().kind() == Scope::Kind::Block) {
if (currScope().kind() == Scope::Kind::BlockConstruct) {
Say(MessageFormattedText{
"%s statement is not allowed in a BLOCK construct"_err_en_US, stmt});
return false;
@ -5302,7 +5303,7 @@ void DeclarationVisitor::CheckSaveStmts() {
if (auto *symbol{currScope().FindCommonBlock(name)}) {
auto &objects{symbol->get<CommonBlockDetails>().objects()};
if (objects.empty()) {
if (currScope().kind() != Scope::Kind::Block) {
if (currScope().kind() != Scope::Kind::BlockConstruct) {
Say(name,
"'%s' appears as a COMMON block in a SAVE statement but not in"
" a COMMON statement"_err_en_US);
@ -6037,7 +6038,7 @@ bool ConstructVisitor::Pre(const parser::DataStmtValue &x) {
bool ConstructVisitor::Pre(const parser::DoConstruct &x) {
if (x.IsDoConcurrent()) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
}
return true;
}
@ -6060,7 +6061,7 @@ void ConstructVisitor::Post(const parser::ForallStmt &) { PopScope(); }
bool ConstructVisitor::Pre(const parser::BlockStmt &x) {
CheckDef(x.v);
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::BlockConstruct, nullptr);
return false;
}
bool ConstructVisitor::Pre(const parser::EndBlockStmt &x) {
@ -6075,7 +6076,7 @@ void ConstructVisitor::Post(const parser::Selector &x) {
void ConstructVisitor::Post(const parser::AssociateStmt &x) {
CheckDef(x.t);
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
const auto assocCount{std::get<std::list<parser::Association>>(x.t).size()};
for (auto nthLastAssoc{assocCount}; nthLastAssoc > 0; --nthLastAssoc) {
SetCurrentAssociation(nthLastAssoc);
@ -6104,7 +6105,7 @@ bool ConstructVisitor::Pre(const parser::Association &x) {
bool ConstructVisitor::Pre(const parser::ChangeTeamStmt &x) {
CheckDef(x.t);
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
PushAssociation();
return true;
}
@ -6192,7 +6193,7 @@ void ConstructVisitor::Post(const parser::SelectRankStmt &x) {
}
bool ConstructVisitor::Pre(const parser::SelectTypeConstruct::TypeCase &) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
return true;
}
void ConstructVisitor::Post(const parser::SelectTypeConstruct::TypeCase &) {
@ -6200,7 +6201,7 @@ void ConstructVisitor::Post(const parser::SelectTypeConstruct::TypeCase &) {
}
bool ConstructVisitor::Pre(const parser::SelectRankConstruct::RankCase &) {
PushScope(Scope::Kind::Block, nullptr);
PushScope(Scope::Kind::OtherConstruct, nullptr);
return true;
}
void ConstructVisitor::Post(const parser::SelectRankConstruct::RankCase &) {

View File

@ -76,6 +76,26 @@ const Scope &GetProgramUnitContaining(const Symbol &symbol) {
return GetProgramUnitContaining(symbol.owner());
}
const Scope &GetProgramUnitOrBlockConstructContaining(const Scope &start) {
CHECK(!start.IsTopLevel());
return DEREF(FindScopeContaining(start, [](const Scope &scope) {
switch (scope.kind()) {
case Scope::Kind::Module:
case Scope::Kind::MainProgram:
case Scope::Kind::Subprogram:
case Scope::Kind::BlockData:
case Scope::Kind::BlockConstruct:
return true;
default:
return false;
}
}));
}
const Scope &GetProgramUnitOrBlockConstructContaining(const Symbol &symbol) {
return GetProgramUnitOrBlockConstructContaining(symbol.owner());
}
const Scope *FindPureProcedureContaining(const Scope &start) {
// N.B. We only need to examine the innermost containing program unit
// because an internal subprogram of a pure subprogram must also
@ -202,9 +222,10 @@ bool IsCommonBlockContaining(const Symbol &block, const Symbol &object) {
}
bool IsUseAssociated(const Symbol &symbol, const Scope &scope) {
const Scope &owner{GetProgramUnitContaining(symbol.GetUltimate().owner())};
const Scope &owner{
GetProgramUnitOrBlockConstructContaining(symbol.GetUltimate().owner())};
return owner.kind() == Scope::Kind::Module &&
owner != GetProgramUnitContaining(scope);
owner != GetProgramUnitOrBlockConstructContaining(scope);
}
bool DoesScopeContain(
@ -229,9 +250,9 @@ static const Symbol &FollowHostAssoc(const Symbol &symbol) {
}
bool IsHostAssociated(const Symbol &symbol, const Scope &scope) {
const Scope &subprogram{GetProgramUnitContaining(scope)};
return DoesScopeContain(
&GetProgramUnitContaining(FollowHostAssoc(symbol)), subprogram);
&GetProgramUnitOrBlockConstructContaining(FollowHostAssoc(symbol)),
GetProgramUnitOrBlockConstructContaining(scope));
}
bool IsInStmtFunction(const Symbol &symbol) {

View File

@ -14,11 +14,11 @@ program mm
b = 2
!$acc parallel present(c) firstprivate(b) private(a)
!$acc loop
!DEF: /mm/Block1/i (AccPrivate, AccPreDetermined) HostAssoc INTEGER(4)
!DEF: /mm/OtherConstruct1/i (AccPrivate, AccPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /mm/Block1/a (AccPrivate) HostAssoc INTEGER(4)
!REF: /mm/Block1/i
!DEF: /mm/Block1/b (AccFirstPrivate) HostAssoc INTEGER(4)
!DEF: /mm/OtherConstruct1/a (AccPrivate) HostAssoc INTEGER(4)
!REF: /mm/OtherConstruct1/i
!DEF: /mm/OtherConstruct1/b (AccFirstPrivate) HostAssoc INTEGER(4)
a(i) = b(i)
end do
!$acc end parallel

View File

@ -15,11 +15,11 @@ program ompdoschedule
!REF: /ompdoschedule/b
b = 10
!$omp do schedule(static,b-b)
!DEF: /ompdoschedule/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /ompdoschedule/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /ompdoschedule/n
do i = 2,n+1
!REF: /ompdoschedule/y
!REF: /ompdoschedule/Block1/i
!REF: /ompdoschedule/OtherConstruct1/i
!REF: /ompdoschedule/z
!REF: /ompdoschedule/a
y(i) = z(i-1) + a(i)

View File

@ -20,10 +20,10 @@ subroutine tds
!REF: /tds/k
k = 12
!$omp do schedule(static,j-k)
!DEF: /tds/Block1/i (OmpPrivate,OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /tds/OtherConstruct1/i (OmpPrivate,OmpPreDetermined) HostAssoc INTEGER(4)
do i = 1,10
!REF: /tds/y
!REF: /tds/Block1/i
!REF: /tds/OtherConstruct1/i
!REF: /tds/z
!REF: /tds/a
y(i) = z(i-1)+a(i)

View File

@ -10,7 +10,7 @@ program omp_do
integer i
!$omp do firstprivate(k)
!DEF: /omp_do/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
print *, "Hello"
end do

View File

@ -11,7 +11,7 @@ program omp_do1
integer i, j, k, n
!$omp threadprivate (k,n)
!$omp do
!DEF: /omp_do1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_do1/j
do j=1,10

View File

@ -9,7 +9,7 @@ program omp_do
!DEF: /omp_do/n ObjectEntity INTEGER(4)
integer i,n
!$omp parallel
!DEF: /omp_do/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!$omp single
print *, "hello"
@ -19,13 +19,13 @@ program omp_do
!$omp parallel default(shared)
!$omp do
!DEF: /omp_do/Block2/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do/OtherConstruct2/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /omp_do/n
do i=1,n
!$omp parallel
!$omp single
!DEF: /work EXTERNAL (Subroutine) ProcEntity
!REF: /omp_do/Block2/Block1/i
!REF: /omp_do/OtherConstruct2/OtherConstruct1/i
call work(i, 1)
!$omp end single
!$omp end parallel

View File

@ -12,7 +12,7 @@ program omp_do
!DEF: /omp_do/k ObjectEntity INTEGER(4)
integer i, j, k
!$omp do ordered
!DEF: /omp_do/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!$omp ordered
!DEF: /my_func EXTERNAL (Subroutine) ProcEntity

View File

@ -9,11 +9,11 @@ program omp_do
!DEF: /omp_do/k ObjectEntity INTEGER(4)
integer i, j, k
!$omp do
!DEF: /omp_do/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_do/j
do j=1,10
!REF: /omp_do/Block1/i
!REF: /omp_do/OtherConstruct1/i
!REF: /omp_do/j
print *, "it", i, j
end do
@ -27,9 +27,9 @@ subroutine omp_do2
!DEF: /omp_do2/k ObjectEntity INTEGER(4)
integer :: i = 0, k
!$omp do
!DEF: /omp_do2/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_do2/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_do2/Block1/i
!REF: /omp_do2/OtherConstruct1/i
print *, "it", i
end do
!$omp end do

View File

@ -5,15 +5,15 @@
!DEF: /omp_cycle MainProgram
program omp_cycle
!$omp do collapse(1)
!DEF: /omp_cycle/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!REF: /omp_cycle/Block1/i
!REF: /omp_cycle/OtherConstruct1/i
if (i<1) cycle
!DEF: /omp_cycle/j (Implicit) ObjectEntity INTEGER(4)
do j=0,10
!DEF: /omp_cycle/k (Implicit) ObjectEntity INTEGER(4)
do k=0,10
!REF: /omp_cycle/Block1/i
!REF: /omp_cycle/OtherConstruct1/i
!REF: /omp_cycle/j
!REF: /omp_cycle/k
print *, i, j, k
@ -23,15 +23,15 @@ program omp_cycle
!$omp end do
!$omp do collapse(1)
!DEF: /omp_cycle/Block2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!REF: /omp_cycle/j
do j=0,10
!REF: /omp_cycle/Block2/i
!REF: /omp_cycle/OtherConstruct2/i
if (i<1) cycle
!REF: /omp_cycle/k
do k=0,10
!REF: /omp_cycle/Block2/i
!REF: /omp_cycle/OtherConstruct2/i
!REF: /omp_cycle/j
!REF: /omp_cycle/k
print *, i, j, k
@ -41,16 +41,16 @@ program omp_cycle
!$omp end do
!$omp do collapse(2)
!DEF: /omp_cycle/Block3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!DEF: /omp_cycle/Block3/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct3/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=0,10
!REF: /omp_cycle/k
do k=0,10
!REF: /omp_cycle/Block3/i
!REF: /omp_cycle/OtherConstruct3/i
if (i<1) cycle
!REF: /omp_cycle/Block3/i
!REF: /omp_cycle/Block3/j
!REF: /omp_cycle/OtherConstruct3/i
!REF: /omp_cycle/OtherConstruct3/j
!REF: /omp_cycle/k
print *, i, j, k
end do
@ -59,17 +59,17 @@ program omp_cycle
!$omp end do
!$omp do collapse(3)
!DEF: /omp_cycle/Block4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!DEF: /omp_cycle/Block4/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct4/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=0,10
!DEF: /omp_cycle/Block4/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct4/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do k=0,10
!REF: /omp_cycle/Block4/i
!REF: /omp_cycle/OtherConstruct4/i
if (i<1) cycle
!REF: /omp_cycle/Block4/i
!REF: /omp_cycle/Block4/j
!REF: /omp_cycle/Block4/k
!REF: /omp_cycle/OtherConstruct4/i
!REF: /omp_cycle/OtherConstruct4/j
!REF: /omp_cycle/OtherConstruct4/k
print *, i, j, k
end do
end do
@ -77,17 +77,17 @@ program omp_cycle
!$omp end do
!$omp do collapse(3)
!DEF: /omp_cycle/Block5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo:do i=0,10
!DEF: /omp_cycle/Block5/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct5/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo1:do j=0,10
!DEF: /omp_cycle/Block5/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct5/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo2:do k=0,10
!REF: /omp_cycle/Block5/i
!REF: /omp_cycle/OtherConstruct5/i
if (i<1) cycle foo2
!REF: /omp_cycle/Block5/i
!REF: /omp_cycle/Block5/j
!REF: /omp_cycle/Block5/k
!REF: /omp_cycle/OtherConstruct5/i
!REF: /omp_cycle/OtherConstruct5/j
!REF: /omp_cycle/OtherConstruct5/k
print *, i, j, k
end do foo2
end do foo1

View File

@ -5,14 +5,14 @@
!DEF: /omp_cycle MainProgram
program omp_cycle
!$omp do collapse(1)
!DEF: /omp_cycle/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
cycle
!DEF: /omp_cycle/j (Implicit) ObjectEntity INTEGER(4)
do j=0,10
!DEF: /omp_cycle/k (Implicit) ObjectEntity INTEGER(4)
do k=0,10
!REF: /omp_cycle/Block1/i
!REF: /omp_cycle/OtherConstruct1/i
!REF: /omp_cycle/j
!REF: /omp_cycle/k
print *, i, j, k
@ -22,14 +22,14 @@ program omp_cycle
!$omp end do
!$omp do collapse(1)
!DEF: /omp_cycle/Block2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!REF: /omp_cycle/j
do j=0,10
cycle
!REF: /omp_cycle/k
do k=0,10
!REF: /omp_cycle/Block2/i
!REF: /omp_cycle/OtherConstruct2/i
!REF: /omp_cycle/j
!REF: /omp_cycle/k
print *, i, j, k
@ -39,15 +39,15 @@ program omp_cycle
!$omp end do
!$omp do collapse(2)
!DEF: /omp_cycle/Block3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!DEF: /omp_cycle/Block3/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct3/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=0,10
!REF: /omp_cycle/k
do k=0,10
cycle
!REF: /omp_cycle/Block3/i
!REF: /omp_cycle/Block3/j
!REF: /omp_cycle/OtherConstruct3/i
!REF: /omp_cycle/OtherConstruct3/j
!REF: /omp_cycle/k
print *, i, j, k
end do
@ -56,16 +56,16 @@ program omp_cycle
!$omp end do
!$omp do collapse(3)
!DEF: /omp_cycle/Block4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=0,10
!DEF: /omp_cycle/Block4/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct4/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=0,10
!DEF: /omp_cycle/Block4/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct4/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do k=0,10
cycle
!REF: /omp_cycle/Block4/i
!REF: /omp_cycle/Block4/j
!REF: /omp_cycle/Block4/k
!REF: /omp_cycle/OtherConstruct4/i
!REF: /omp_cycle/OtherConstruct4/j
!REF: /omp_cycle/OtherConstruct4/k
print *, i, j, k
end do
end do
@ -73,16 +73,16 @@ program omp_cycle
!$omp end do
!$omp do ordered(3)
!DEF: /omp_cycle/Block5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo:do i=0,10
!DEF: /omp_cycle/Block5/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct5/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo1:do j=0,10
!DEF: /omp_cycle/Block5/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_cycle/OtherConstruct5/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo2:do k=0,10
cycle foo2
!REF: /omp_cycle/Block5/i
!REF: /omp_cycle/Block5/j
!REF: /omp_cycle/Block5/k
!REF: /omp_cycle/OtherConstruct5/i
!REF: /omp_cycle/OtherConstruct5/j
!REF: /omp_cycle/OtherConstruct5/k
print *, i, j, k
end do foo2
end do foo1

View File

@ -9,21 +9,21 @@ program test
!DEF: /test/k ObjectEntity INTEGER(4)
integer i, j, k
!$omp do collapse(2)
!DEF: /test/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo: do i=0,10
!DEF: /test/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test/OtherConstruct1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo1: do j=0,10
!REF: /test/k
foo2: do k=0,10
!REF: /test/Block1/i
!REF: /test/OtherConstruct1/i
select case (i)
case (5)
cycle foo1
case (7)
cycle foo2
end select
!REF: /test/Block1/i
!REF: /test/Block1/j
!REF: /test/OtherConstruct1/i
!REF: /test/OtherConstruct1/j
!REF: /test/k
print *, i, j, k
end do foo2
@ -31,23 +31,23 @@ program test
end do foo
!$omp do collapse(2)
!DEF: /test/Block2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test/OtherConstruct2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo: do i=0,10
!DEF: /test/Block2/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test/OtherConstruct2/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
foo1: do j=0,10
!REF: /test/k
foo2: do k=0,10
!REF: /test/Block2/i
!REF: /test/OtherConstruct2/i
if (i<3) then
cycle foo1
!REF: /test/Block2/i
!REF: /test/OtherConstruct2/i
else if (i>8) then
cycle foo1
else
cycle foo2
end if
!REF: /test/Block2/i
!REF: /test/Block2/j
!REF: /test/OtherConstruct2/i
!REF: /test/OtherConstruct2/j
!REF: /test/k
print *, i, j, k
end do foo2

View File

@ -11,9 +11,9 @@ program omp_reduction
!DEF: /omp_reduction/m ObjectEntity INTEGER(4)
integer :: m = 12
!$omp parallel do reduction(max:k)
!DEF: /omp_reduction/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block1/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct1/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/max ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /omp_reduction/m
k = max(k, m)
@ -21,9 +21,9 @@ program omp_reduction
!$omp end parallel do
!$omp parallel do reduction(min:k)
!DEF: /omp_reduction/Block2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block2/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct2/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/min ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /omp_reduction/m
k = min(k, m)
@ -31,9 +31,9 @@ program omp_reduction
!$omp end parallel do
!$omp parallel do reduction(iand:k)
!DEF: /omp_reduction/Block3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block3/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct3/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/iand ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /omp_reduction/m
k = iand(k, m)
@ -41,9 +41,9 @@ program omp_reduction
!$omp end parallel do
!$omp parallel do reduction(ior:k)
!DEF: /omp_reduction/Block4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block4/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct4/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/ior ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /omp_reduction/m
k = ior(k, m)
@ -51,9 +51,9 @@ program omp_reduction
!$omp end parallel do
!$omp parallel do reduction(ieor:k)
!DEF: /omp_reduction/Block5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block5/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct5/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/ieor ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /omp_reduction/m
k = ieor(k,m)

View File

@ -14,9 +14,9 @@ program omp_reduction
!$omp parallel shared(k)
!$omp do reduction(+:k)
!DEF: /omp_reduction/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block1/Block1/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct1/OtherConstruct1/k (OmpReduction) HostAssoc INTEGER(4)
k = k+1
end do
!$omp end do
@ -24,7 +24,7 @@ program omp_reduction
!$omp parallel do reduction(+:a(10))
!DEF: /omp_reduction/Block2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct2/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_reduction/k
k = k+1
@ -33,7 +33,7 @@ program omp_reduction
!$omp parallel do reduction(+:a(1:10:1))
!DEF: /omp_reduction/Block3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct3/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_reduction/k
k = k+1
@ -41,7 +41,7 @@ program omp_reduction
!$omp end parallel do
!$omp parallel do reduction(+:b(1:10:1,1:5,2))
!DEF: /omp_reduction/Block4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct4/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_reduction/k
k = k+1
@ -49,7 +49,7 @@ program omp_reduction
!$omp end parallel do
!$omp parallel do reduction(+:b(1:10:1,1:5,2:5:1))
!DEF: /omp_reduction/Block5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct5/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /omp_reduction/k
k = k+1
@ -58,27 +58,27 @@ program omp_reduction
!$omp parallel private(i)
!$omp do reduction(+:k) reduction(+:j)
!DEF: /omp_reduction/Block6/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct6/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block6/Block1/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct6/OtherConstruct1/k (OmpReduction) HostAssoc INTEGER(4)
k = k+1
end do
!$omp end do
!$omp end parallel
!$omp do reduction(-:k) reduction(*:j) reduction(-:l)
!DEF: /omp_reduction/Block7/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct7/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block7/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct7/k (OmpReduction) HostAssoc INTEGER(4)
k = k+1
end do
!$omp end do
!$omp do reduction(.and.:k) reduction(.or.:j) reduction(.eqv.:l)
!DEF: /omp_reduction/Block8/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct8/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /omp_reduction/Block8/k (OmpReduction) HostAssoc INTEGER(4)
!DEF: /omp_reduction/OtherConstruct8/k (OmpReduction) HostAssoc INTEGER(4)
k = k+1
end do
!$omp end do

View File

@ -45,22 +45,22 @@ program mm
!DEF: /mm/c (Implicit) ObjectEntity REAL(4)
c = 2.0
!$omp parallel do private(a,t,/c/) shared(c)
!DEF: /mm/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /mm/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /mm/Block1/a (OmpPrivate) HostAssoc REAL(4)
!DEF: /mm/OtherConstruct1/a (OmpPrivate) HostAssoc REAL(4)
!REF: /mm/b
!REF: /mm/Block1/i
!REF: /mm/OtherConstruct1/i
a = a+b(i)
!DEF: /mm/Block1/t (OmpPrivate) HostAssoc TYPE(myty)
!DEF: /mm/OtherConstruct1/t (OmpPrivate) HostAssoc TYPE(myty)
!REF: /md/myty/a
!REF: /mm/Block1/i
!REF: /mm/OtherConstruct1/i
t%a = i
!DEF: /mm/Block1/y (OmpPrivate) HostAssoc REAL(4)
!DEF: /mm/OtherConstruct1/y (OmpPrivate) HostAssoc REAL(4)
y = 0.
!DEF: /mm/Block1/x (OmpPrivate) HostAssoc REAL(4)
!REF: /mm/Block1/a
!REF: /mm/Block1/i
!REF: /mm/Block1/y
!DEF: /mm/OtherConstruct1/x (OmpPrivate) HostAssoc REAL(4)
!REF: /mm/OtherConstruct1/a
!REF: /mm/OtherConstruct1/i
!REF: /mm/OtherConstruct1/y
x = a+i+y
!REF: /mm/c
c = 3.0

View File

@ -11,9 +11,9 @@
!DEF: /MainProgram1/c (Implicit) ObjectEntity REAL(4)
c = 0
!$omp parallel private(a,b) shared(c,d)
!DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(4)
!DEF: /MainProgram1/OtherConstruct1/a (OmpPrivate) HostAssoc REAL(4)
a = 3.
!DEF: /MainProgram1/Block1/b (OmpPrivate) HostAssoc REAL(4)
!DEF: /MainProgram1/OtherConstruct1/b (OmpPrivate) HostAssoc REAL(4)
b = 4
!REF: /MainProgram1/c
c = 5

View File

@ -7,14 +7,14 @@
!DEF: /MainProgram1/b (Implicit) ObjectEntity REAL(4)
b = 2
!$omp parallel private(a) shared(b)
!DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(4)
!DEF: /MainProgram1/OtherConstruct1/a (OmpPrivate) HostAssoc REAL(4)
a = 3.
!REF: /MainProgram1/b
b = 4
!$omp parallel private(b) shared(a)
!REF: /MainProgram1/Block1/a
!REF: /MainProgram1/OtherConstruct1/a
a = 5.
!DEF: /MainProgram1/Block1/Block1/b (OmpPrivate) HostAssoc REAL(4)
!DEF: /MainProgram1/OtherConstruct1/OtherConstruct1/b (OmpPrivate) HostAssoc REAL(4)
b = 6
!$omp end parallel
!$omp end parallel

View File

@ -9,12 +9,12 @@
!REF: /MainProgram1/a
a = 3.14
!$omp parallel private(a)
!DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(8)
!DEF: /MainProgram1/OtherConstruct1/a (OmpPrivate) HostAssoc REAL(8)
a = 2.
!$omp do private(a)
!DEF: /MainProgram1/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /MainProgram1/OtherConstruct1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /MainProgram1/Block1/Block1/a (OmpPrivate) HostAssoc REAL(8)
!DEF: /MainProgram1/OtherConstruct1/OtherConstruct1/a (OmpPrivate) HostAssoc REAL(8)
a = 1.
end do
!$omp end parallel

View File

@ -24,9 +24,9 @@ contains
!REF: /mm/foo/a
print *, a
block
!DEF: /mm/foo/Block2/i ObjectEntity REAL(4)
!DEF: /mm/foo/BlockConstruct1/i ObjectEntity REAL(4)
real i
!REF: /mm/foo/Block2/i
!REF: /mm/foo/BlockConstruct1/i
i = 3.14
end block
end subroutine foo

View File

@ -8,9 +8,9 @@
!DEF: /MainProgram1/a (Implicit) ObjectEntity REAL(4)
a = 1.
!$omp parallel do firstprivate(a) lastprivate(a)
!DEF: /MainProgram1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /MainProgram1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!DEF: /MainProgram1/Block1/a (OmpFirstPrivate, OmpLastPrivate) HostAssoc REAL(4)
!DEF: /MainProgram1/OtherConstruct1/a (OmpFirstPrivate, OmpLastPrivate) HostAssoc REAL(4)
a = 2.
end do
end program

View File

@ -21,7 +21,7 @@ subroutine function_call_in_region
!DEF: /function_call_in_region/b ObjectEntity REAL(4)
real :: b = 5.
!$omp parallel default(none) private(a) shared(b)
!DEF: /function_call_in_region/Block1/a (OmpPrivate) HostAssoc REAL(4)
!DEF: /function_call_in_region/OtherConstruct1/a (OmpPrivate) HostAssoc REAL(4)
!REF: /function_call_in_region/foo
!REF: /function_call_in_region/b
a = foo(b)

View File

@ -31,18 +31,18 @@ subroutine test_do
!REF: /test_do/i
i = 99
!$omp do collapse(2)
!DEF: /test_do/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_do/OtherConstruct1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,5
!DEF: /test_do/Block1/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_do/OtherConstruct1/OtherConstruct1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=6,10
!REF: /test_do/a
a(1,1,1) = 0.
!DEF: /test_do/Block1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_do/OtherConstruct1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do k=11,15
!REF: /test_do/a
!REF: /test_do/Block1/k
!REF: /test_do/Block1/Block1/j
!REF: /test_do/Block1/Block1/i
!REF: /test_do/OtherConstruct1/k
!REF: /test_do/OtherConstruct1/OtherConstruct1/j
!REF: /test_do/OtherConstruct1/OtherConstruct1/i
a(k,j,i) = 1.
end do
end do
@ -61,18 +61,18 @@ subroutine test_pardo
!DEF: /test_pardo/k ObjectEntity INTEGER(4)
integer i, j, k
!$omp parallel do collapse(2) private(k) ordered(2)
!DEF: /test_pardo/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_pardo/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,5
!DEF: /test_pardo/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_pardo/OtherConstruct1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=6,10
!REF: /test_pardo/a
a(1,1,1) = 0.
!DEF: /test_pardo/Block1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_pardo/OtherConstruct1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do k=11,15
!REF: /test_pardo/a
!REF: /test_pardo/Block1/k
!REF: /test_pardo/Block1/j
!REF: /test_pardo/Block1/i
!REF: /test_pardo/OtherConstruct1/k
!REF: /test_pardo/OtherConstruct1/j
!REF: /test_pardo/OtherConstruct1/i
a(k,j,i) = 1.
end do
end do
@ -89,14 +89,14 @@ subroutine test_taskloop
!DEF: /test_taskloop/j ObjectEntity INTEGER(4)
integer i, j
!$omp taskloop private(j)
!DEF: /test_taskloop/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_taskloop/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,5
!DEF: /test_taskloop/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /test_taskloop/Block1/i
!DEF: /test_taskloop/OtherConstruct1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /test_taskloop/OtherConstruct1/i
do j=1,i
!REF: /test_taskloop/a
!REF: /test_taskloop/Block1/j
!REF: /test_taskloop/Block1/i
!REF: /test_taskloop/OtherConstruct1/j
!REF: /test_taskloop/OtherConstruct1/i
a(j,i) = 3.14
end do
end do
@ -132,20 +132,20 @@ subroutine dotprod (b, c, n, block_size, num_teams, block_threads)
!$omp target map(to:b,c) map(tofrom:sum)
!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+:sum)
!$omp distribute
!DEF: /dotprod/Block1/Block1/Block1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /dotprod/n
!REF: /dotprod/block_size
do i0=1,n,block_size
!$omp parallel do reduction(+:sum)
!DEF: /dotprod/Block1/Block1/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /dotprod/Block1/Block1/Block1/i0
!DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/i0
!DEF: /dotprod/min ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /dotprod/block_size
!REF: /dotprod/n
do i=i0,min(i0+block_size, n)
!DEF: /dotprod/Block1/Block1/Block1/Block1/sum (OmpReduction) HostAssoc REAL(4)
!DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/OtherConstruct1/sum (OmpReduction) HostAssoc REAL(4)
!REF: /dotprod/b
!REF: /dotprod/Block1/Block1/Block1/Block1/i
!REF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/OtherConstruct1/i
!REF: /dotprod/c
sum = sum+b(i)*c(i)
end do
@ -168,16 +168,16 @@ subroutine test_simd
!DEF: /test_simd/k ObjectEntity INTEGER(4)
integer i, j, k
!$omp parallel do simd
!DEF: /test_simd/Block1/i (OmpLinear, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_simd/OtherConstruct1/i (OmpLinear, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,5
!DEF: /test_simd/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_simd/OtherConstruct1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=6,10
!DEF: /test_simd/Block1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_simd/OtherConstruct1/k (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do k=11,15
!REF: /test_simd/a
!REF: /test_simd/Block1/k
!REF: /test_simd/Block1/j
!REF: /test_simd/Block1/i
!REF: /test_simd/OtherConstruct1/k
!REF: /test_simd/OtherConstruct1/j
!REF: /test_simd/OtherConstruct1/i
a(k,j,i) = 3.14
end do
end do
@ -195,16 +195,16 @@ subroutine test_simd_multi
!DEF: /test_simd_multi/k ObjectEntity INTEGER(4)
integer i, j, k
!$omp parallel do simd collapse(3)
!DEF: /test_simd_multi/Block1/i (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_simd_multi/OtherConstruct1/i (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,5
!DEF: /test_simd_multi/Block1/j (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_simd_multi/OtherConstruct1/j (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do j=6,10
!DEF: /test_simd_multi/Block1/k (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_simd_multi/OtherConstruct1/k (OmpLastPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do k=11,15
!REF: /test_simd_multi/a
!REF: /test_simd_multi/Block1/k
!REF: /test_simd_multi/Block1/j
!REF: /test_simd_multi/Block1/i
!REF: /test_simd_multi/OtherConstruct1/k
!REF: /test_simd_multi/OtherConstruct1/j
!REF: /test_simd_multi/OtherConstruct1/i
a(k,j,i) = 3.14
end do
end do
@ -228,17 +228,17 @@ subroutine test_seq_loop
print *, i, j
!$omp parallel
!REF: /test_seq_loop/i
!DEF: /test_seq_loop/Block1/Block1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_seq_loop/OtherConstruct1/OtherConstruct1/j (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
print *, i, j
!$omp do
!DEF: /test_seq_loop/Block1/Block1/Block1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!DEF: /test_seq_loop/OtherConstruct1/OtherConstruct1/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
do i=1,10
!REF: /test_seq_loop/Block1/Block1/j
!REF: /test_seq_loop/OtherConstruct1/OtherConstruct1/j
do j=1,10
end do
end do
!REF: /test_seq_loop/i
!REF: /test_seq_loop/Block1/Block1/j
!REF: /test_seq_loop/OtherConstruct1/OtherConstruct1/j
print *, i, j
!$omp end parallel
!REF: /test_seq_loop/i

View File

@ -1,15 +1,17 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
! Ensure that implicit declarations work in DATA statements
! appearing in specification parts of inner procedures; they
! should not elicit diagnostics about initialization of host
! associated objects.
program main
contains
subroutine subr
data foo/6.66/ ! implicit declaration of "foo": ok
integer m
!ERROR: Implicitly typed local entity 'n' not allowed in specification expression
real a(n)
!ERROR: Host-associated object 'n' must not be initialized in a DATA statement
data n/123/
block
real b(m)
!ERROR: Host-associated object 'm' must not be initialized in a DATA statement
data m/10/
end block
end subroutine
end program

View File

@ -6,17 +6,17 @@ subroutine s1
!DEF: /s1/x ObjectEntity INTEGER(4)
integer x
block
!DEF: /s1/Block1/y ObjectEntity INTEGER(4)
!DEF: /s1/BlockConstruct1/y ObjectEntity INTEGER(4)
integer y
!REF: /s1/x
x = 1
!REF: /s1/Block1/y
!REF: /s1/BlockConstruct1/y
y = 2.0
end block
block
!DEF: /s1/Block2/y ObjectEntity REAL(4)
!DEF: /s1/BlockConstruct2/y ObjectEntity REAL(4)
real y
!REF: /s1/Block2/y
!REF: /s1/BlockConstruct2/y
y = 3.0
end block
end subroutine
@ -45,13 +45,13 @@ subroutine s3
!DEF: /s3/j ObjectEntity INTEGER(8)
integer(kind=8) j
block
!DEF: /s3/Block1/t DerivedType
!DEF: /s3/BlockConstruct1/t DerivedType
type :: t
!DEF: /s3/Block1/t/x ObjectEntity REAL(4)
!DEF: /s3/Block1/t/ImpliedDos1/i (Implicit) ObjectEntity INTEGER(4)
!DEF: /s3/BlockConstruct1/t/x ObjectEntity REAL(4)
!DEF: /s3/BlockConstruct1/t/ImpliedDos1/i (Implicit) ObjectEntity INTEGER(4)
real :: x(10) = [(i, i=1,10)]
!DEF: /s3/Block1/t/y ObjectEntity REAL(4)
!DEF: /s3/Block1/t/ImpliedDos2/j ObjectEntity INTEGER(8)
!DEF: /s3/BlockConstruct1/t/y ObjectEntity REAL(4)
!DEF: /s3/BlockConstruct1/t/ImpliedDos2/j ObjectEntity INTEGER(8)
real :: y(10) = [(j, j=1,10)]
end type
end block
@ -73,10 +73,10 @@ end subroutine
!DEF: /s5 (Subroutine) Subprogram
subroutine s5
block
!DEF: /s5/Block1/x (Implicit) ObjectEntity REAL(4)
!DEF: /s5/BlockConstruct1/x (Implicit) ObjectEntity REAL(4)
dimension :: x(2)
block
!DEF: /s5/Block1/Block1/x (Implicit) ObjectEntity REAL(4)
!DEF: /s5/BlockConstruct1/BlockConstruct1/x (Implicit) ObjectEntity REAL(4)
dimension :: x(3)
end block
end block
@ -91,13 +91,13 @@ subroutine s6
!DEF: /s6/k ObjectEntity INTEGER(4)
integer i, j, k
block
!DEF: /s6/Block1/i ASYNCHRONOUS, VOLATILE HostAssoc INTEGER(4)
!DEF: /s6/BlockConstruct1/i ASYNCHRONOUS, VOLATILE HostAssoc INTEGER(4)
volatile :: i
!DEF: /s6/Block1/j ASYNCHRONOUS HostAssoc INTEGER(4)
!DEF: /s6/BlockConstruct1/j ASYNCHRONOUS HostAssoc INTEGER(4)
asynchronous :: j
!REF: /s6/Block1/i
!REF: /s6/BlockConstruct1/i
asynchronous :: i
!DEF: /s6/Block1/k TARGET (Implicit) ObjectEntity INTEGER(4)
!DEF: /s6/BlockConstruct1/k TARGET (Implicit) ObjectEntity INTEGER(4)
target :: k
end block
end subroutine

View File

@ -25,10 +25,10 @@ subroutine s2
real a(10)
!DEF: /s2/i ObjectEntity INTEGER(4)
integer i
!DEF: /s2/Block1/i ObjectEntity INTEGER(4)
!DEF: /s2/OtherConstruct1/i ObjectEntity INTEGER(4)
do concurrent(i=1:10)
!REF: /s2/a
!REF: /s2/Block1/i
!REF: /s2/OtherConstruct1/i
a(i) = i
end do
!REF: /s2/i
@ -104,14 +104,14 @@ subroutine s6
integer(kind=8) j
!DEF: /s6/a ObjectEntity INTEGER(4)
integer :: a(5) = 1
!DEF: /s6/Block1/i ObjectEntity INTEGER(4)
!DEF: /s6/Block1/j (LocalityLocal) HostAssoc INTEGER(8)
!DEF: /s6/Block1/k (Implicit, LocalityLocalInit) HostAssoc INTEGER(4)
!DEF: /s6/Block1/a (LocalityShared) HostAssoc INTEGER(4)
!DEF: /s6/OtherConstruct1/i ObjectEntity INTEGER(4)
!DEF: /s6/OtherConstruct1/j (LocalityLocal) HostAssoc INTEGER(8)
!DEF: /s6/OtherConstruct1/k (Implicit, LocalityLocalInit) HostAssoc INTEGER(4)
!DEF: /s6/OtherConstruct1/a (LocalityShared) HostAssoc INTEGER(4)
do concurrent(integer::i=1:5)local(j)local_init(k)shared(a)
!REF: /s6/Block1/a
!REF: /s6/Block1/i
!REF: /s6/Block1/j
!REF: /s6/OtherConstruct1/a
!REF: /s6/OtherConstruct1/i
!REF: /s6/OtherConstruct1/j
a(i) = j+1
end do
end subroutine

View File

@ -12,14 +12,14 @@ subroutine s1
!REF: /s1/t
!DEF: /s1/z ALLOCATABLE ObjectEntity CLASS(t)
class(t), allocatable :: z
!DEF: /s1/Block1/a AssocEntity REAL(8)
!DEF: /s1/OtherConstruct1/a AssocEntity REAL(8)
!REF: /s1/x
!DEF: /s1/Block1/b AssocEntity REAL(8)
!DEF: /s1/Block1/c AssocEntity CLASS(t)
!DEF: /s1/OtherConstruct1/b AssocEntity REAL(8)
!DEF: /s1/OtherConstruct1/c AssocEntity CLASS(t)
!REF: /s1/z
associate (a => x, b => x+1, c => z)
!REF: /s1/x
!REF: /s1/Block1/a
!REF: /s1/OtherConstruct1/a
x = a
end associate
end subroutine
@ -29,18 +29,18 @@ subroutine s2
!DEF: /s2/x ObjectEntity CHARACTER(4_4,1)
!DEF: /s2/y ObjectEntity CHARACTER(4_4,1)
character(len=4) x, y
!DEF: /s2/Block1/z AssocEntity CHARACTER(4_8,1)
!DEF: /s2/OtherConstruct1/z AssocEntity CHARACTER(4_8,1)
!REF: /s2/x
associate (z => x)
!REF: /s2/Block1/z
!REF: /s2/OtherConstruct1/z
print *, "z:", z
end associate
!TODO: need correct length for z
!DEF: /s2/Block2/z AssocEntity CHARACTER(8_8,1)
!DEF: /s2/OtherConstruct2/z AssocEntity CHARACTER(8_8,1)
!REF: /s2/x
!REF: /s2/y
associate (z => x//y)
!REF: /s2/Block2/z
!REF: /s2/OtherConstruct2/z
print *, "z:", z
end associate
end subroutine
@ -68,17 +68,17 @@ subroutine s3
!REF: /s3/t2
class is (t2)
!REF: /s3/i
!DEF: /s3/Block1/y TARGET AssocEntity TYPE(t2)
!DEF: /s3/OtherConstruct1/y TARGET AssocEntity TYPE(t2)
!REF: /s3/t2/a2
i = y%a2
!REF: /s3/t1
type is (t1)
!REF: /s3/i
!DEF: /s3/Block2/y TARGET AssocEntity TYPE(t1)
!DEF: /s3/OtherConstruct2/y TARGET AssocEntity TYPE(t1)
!REF: /s3/t1/a1
i = y%a1
class default
!DEF: /s3/Block3/y TARGET AssocEntity CLASS(t1)
!DEF: /s3/OtherConstruct3/y TARGET AssocEntity CLASS(t1)
print *, y
end select
end subroutine
@ -99,11 +99,11 @@ subroutine s4
!REF: /s4/t2
!DEF: /s4/x ObjectEntity TYPE(t2)
type(t2) :: x
!DEF: /s4/Block1/y AssocEntity TYPE(t1)
!DEF: /s4/OtherConstruct1/y AssocEntity TYPE(t1)
!REF: /s4/x
!REF: /s4/t2/b
associate(y => x%b)
!REF: /s4/Block1/y
!REF: /s4/OtherConstruct1/y
!REF: /s4/t1/a
y%a = 0.0
end associate
@ -118,11 +118,11 @@ subroutine s5
end type
!DEF: /s5/b ObjectEntity REAL(4)
real b
!DEF: /s5/Block1/x AssocEntity TYPE(t)
!DEF: /s5/OtherConstruct1/x AssocEntity TYPE(t)
!DEF: /s5/f (Function) Subprogram TYPE(t)
associate(x => f())
!REF: /s5/b
!REF: /s5/Block1/x
!REF: /s5/OtherConstruct1/x
!REF: /s5/t/a
b = x%a
end associate