Skip to content

Commit 08c9d6f

Browse files
Print error rather than add symbol
1 parent a0a5241 commit 08c9d6f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,8 +1487,9 @@ class OmpVisitor : public virtual DeclarationVisitor {
14871487
auto &name = std::get<parser::Name>(procDes.u);
14881488
auto *symbol{FindSymbol(NonDerivedTypeScope(), name)};
14891489
if (!symbol) {
1490-
symbol = &MakeSymbol(context().globalScope(), name.source, Attrs{});
1491-
Resolve(name, *symbol);
1490+
context().Say(name.source,
1491+
"Implicit subroutine declaration '%s' in !$OMP DECLARE REDUCTION"_err_en_US,
1492+
name.source);
14921493
}
14931494
return true;
14941495
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
! RUN: not %flang_fc1 -emit-obj -fopenmp -fopenmp-version=50 %s 2>&1 | FileCheck %s
2+
3+
subroutine initme(x,n)
4+
integer x,n
5+
x=n
6+
end subroutine initme
7+
8+
subroutine subr
9+
!$omp declare reduction(red_add:integer(4):omp_out=omp_out+omp_in) initializer(initme(omp_priv,0))
10+
!CHECK: error: Implicit subroutine declaration 'initme' in !$OMP DECLARE REDUCTION
11+
end subroutine subr

0 commit comments

Comments
 (0)