Skip to content

Commit 5c6d4a5

Browse files
committed
[FLANG][OPENMP] Fix handling of continuation lines in mixed OpenMP and Fortran free-form
1 parent c870322 commit 5c6d4a5

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

flang/test/Parser/cd_continuation.f90

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
! RUN: flang-new -fopenmp -E %s 2>&1 | FileCheck %s --check-prefix=CHECK-OMP
2+
! RUN: flang-new -E %s 2>&1 | FileCheck %s
3+
4+
5+
! Test in mixed way, i.e., combination of Fortran free source form
6+
! and free source form with conditional compilation sentinel.
7+
! CHECK-LABEL: subroutine mixed_form1()
8+
! CHECK-OMP: i = 1 +100+ 1000+ 10 + 1 +1000000000 + 1000000
9+
! CHECK: i = 1 + 10 + 10000 + 1000000
10+
subroutine mixed_form1()
11+
i = 1 &
12+
!$+100&
13+
!$&+ 1000&
14+
&+ 10 + 1&
15+
!$& +100000&
16+
&0000 + 1000000
17+
end subroutine
18+
19+
20+
21+
! CHECK-LABEL: subroutine mixed_form2()
22+
! CHECK-OMP: i = 0
23+
! CHECK-OMP: i = 1 +100+ 1000+ 10 + 1 +1000000000 + 1000000
24+
! CHECK: i = 1 + 10 + 10000 + 1000000
25+
subroutine mixed_form2()
26+
!$ i = 0
27+
i = 1 &
28+
!$+100&
29+
!$&+ 1000&
30+
&+ 10 + 1&
31+
!$& +100000&
32+
& 0000 + 1000000
33+
34+
end subroutine
35+
36+
37+
! Testing continuation lines in only Fortran Free form Source
38+
! CHECK-LABEL: subroutine mixed_form3()
39+
! CHECK-OMP: i = 1 +10 +100+ 1000 + 10000
40+
! CHECK: i = 1 +10 +100+ 1000 + 10000
41+
subroutine mixed_form3()
42+
i = 1 &
43+
+10 &
44+
&+100
45+
& + 1000 &
46+
+ 10000
47+
end subroutine
48+
49+
50+
! Testing continuation line in only free source form conditional compilation sentinel.
51+
! CHECK-LABEL: subroutine mixed_form4()
52+
! CHECK-OMP: i=0
53+
! CHECK-OMP: i = 1 +10 +100+1000
54+
subroutine mixed_form4()
55+
!$ i=0
56+
!$ i = 1 &
57+
!$ & +10 &
58+
!$&+100&
59+
!$ +1000
60+
end subroutine
61+

0 commit comments

Comments
 (0)