Skip to content

Commit 3441661

Browse files
akuhlenskrishna2803
authored andcommitted
[flang][openacc] fix a bug with checking data mapping clause when there is no default (llvm#151419)
Test case used to complain about `dosomething` requiring a data mapping clause. Now no such error exists.
1 parent 8899b9b commit 3441661

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,7 @@ void AccAttributeVisitor::Post(const parser::AccDefaultClause &x) {
15451545
void AccAttributeVisitor::Post(const parser::Name &name) {
15461546
auto *symbol{name.symbol};
15471547
if (symbol && !dirContext_.empty() && GetContext().withinConstruct) {
1548+
symbol = &symbol->GetUltimate();
15481549
if (!symbol->owner().IsDerivedType() && !symbol->has<ProcEntityDetails>() &&
15491550
!symbol->has<SubprogramDetails>() && !IsObjectWithDSA(*symbol)) {
15501551
if (Symbol * found{currScope().FindSymbol(name.source)}) {
@@ -1553,8 +1554,7 @@ void AccAttributeVisitor::Post(const parser::Name &name) {
15531554
} else if (GetContext().defaultDSA == Symbol::Flag::AccNone) {
15541555
// 2.5.14.
15551556
context_.Say(name.source,
1556-
"The DEFAULT(NONE) clause requires that '%s' must be listed in "
1557-
"a data-mapping clause"_err_en_US,
1557+
"The DEFAULT(NONE) clause requires that '%s' must be listed in a data-mapping clause"_err_en_US,
15581558
symbol->name());
15591559
}
15601560
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
! RUN: %python %S/../test_errors.py %s %flang -fopenacc -pedantic
2+
3+
module mm_acc_rout_function
4+
contains
5+
integer function dosomething(res)
6+
!$acc routine seq
7+
integer :: res
8+
dosomething = res + 1
9+
end function
10+
end module
11+
12+
program main
13+
use mm_acc_rout_function
14+
implicit none
15+
integer :: res = 1
16+
!$acc serial default(none) copy(res)
17+
res = dosomething(res)
18+
!$acc end serial
19+
end program
20+

0 commit comments

Comments
 (0)