Skip to content

Commit 0cf05e5

Browse files
committed
[flang][OpenMP] Skip implicit typing for DeclareSimdConstruct
DeclareSimdConstruct currently can implicitly declare variables regardless of whether the source code contains "implicit none" or not. This causes semantic analysis issues if the implicit type does not match the declared type. To solve it, skip implicit typing for declare simd. Fixes issue #140754. Signed-off-by: Kajetan Puchalski <[email protected]>
1 parent 41a4b04 commit 0cf05e5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,7 @@ class OmpVisitor : public virtual DeclarationVisitor {
15131513

15141514
bool Pre(const parser::OpenMPDeclareSimdConstruct &x) {
15151515
AddOmpSourceRange(x.source);
1516+
SkipImplicitTyping(true);
15161517
return true;
15171518
}
15181519

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2+
! Test declare simd with linear clause
3+
4+
module mod
5+
contains
6+
subroutine sub(m,i)
7+
!$omp declare simd linear(i:1)
8+
implicit none
9+
integer*8 i,n
10+
value i
11+
parameter(n=10000)
12+
real*4 a,b,m
13+
common/com1/a(n)
14+
common/com2/b(n)
15+
a(i) = b(i) + m
16+
i=i+2
17+
end subroutine
18+
end module

0 commit comments

Comments
 (0)