Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] C1167 : Check for exit statments in do-concurrent
Addresses flang-compiler/f18#288 Original-commit: flang-compiler/f18@2a99e1e Reviewed-on: flang-compiler/f18#345
- Loading branch information
1 parent
6168f68
commit ee6c37e
Showing
4 changed files
with
285 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
! Copyright (c) 2019, Arm Ltd. All rights reserved. | ||
! | ||
! Licensed under the Apache License, Version 2.0 (the "License"); | ||
! you may not use this file except in compliance with the License. | ||
! You may obtain a copy of the License at | ||
! | ||
! http://www.apache.org/licenses/LICENSE-2.0 | ||
! | ||
! Unless required by applicable law or agreed to in writing, software | ||
! distributed under the License is distributed on an "AS IS" BASIS, | ||
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
! See the License for the specific language governing permissions and | ||
! limitations under the License. | ||
|
||
! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s | ||
! CHECK: exit from DO CONCURRENT construct \\(mydoc: do concurrent\\(j=1:n\\)\\) to construct with name 'mydoc' | ||
! CHECK: exit from DO CONCURRENT construct \\(mydoc: do concurrent\\(j=1:n\\)\\) | ||
! CHECK: exit from DO CONCURRENT construct \\(mydoc: do concurrent\\(j=1:n\\)\\) to construct with name 'mytest3' | ||
! CHECK: exit from DO CONCURRENT construct \\(do concurrent\\(k=1:n\\)\\) | ||
! CHECK: exit from DO CONCURRENT construct \\(do concurrent\\(k=1:n\\)\\) to construct with name 'mytest4' | ||
! CHECK: exit from DO CONCURRENT construct \\(mydoc: do concurrent\\(j=1:n\\)\\) to construct with name 'mytest4' | ||
|
||
subroutine do_concurrent_test1(n) | ||
implicit none | ||
integer :: n | ||
integer :: j,k | ||
mydoc: do concurrent(j=1:n) | ||
mydo: do k=1,n | ||
if (k==5) exit mydoc | ||
if (j==10) exit mydo | ||
end do mydo | ||
end do mydoc | ||
end subroutine do_concurrent_test1 | ||
|
||
subroutine do_concurrent_test2(n) | ||
implicit none | ||
integer :: j,k,n | ||
mydoc: do concurrent(j=1:n) | ||
if (k==5) exit | ||
end do mydoc | ||
end subroutine do_concurrent_test2 | ||
|
||
subroutine do_concurrent_test3(n) | ||
implicit none | ||
integer :: j,k,n | ||
mytest3: if (n>0) then | ||
mydoc: do concurrent(j=1:n) | ||
do k=1,n | ||
if (j==10) exit mytest3 | ||
end do | ||
end do mydoc | ||
end if mytest3 | ||
end subroutine do_concurrent_test3 | ||
|
||
subroutine do_concurrent_test4(n) | ||
implicit none | ||
integer :: j,k,n | ||
mytest4: if (n>0) then | ||
mydoc: do concurrent(j=1:n) | ||
do concurrent(k=1:n) | ||
if (k==5) exit | ||
if (j==10) exit mytest4 | ||
end do | ||
end do mydoc | ||
end if mytest4 | ||
end subroutine do_concurrent_test4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
! Copyright (c) 2019, Arm Ltd. All rights reserved. | ||
! | ||
! Licensed under the Apache License, Version 2.0 (the "License"); | ||
! you may not use this file except in compliance with the License. | ||
! You may obtain a copy of the License at | ||
! | ||
! http://www.apache.org/licenses/LICENSE-2.0 | ||
! | ||
! Unless required by applicable law or agreed to in writing, software | ||
! distributed under the License is distributed on an "AS IS" BASIS, | ||
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
! See the License for the specific language governing permissions and | ||
! limitations under the License. | ||
|
||
! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s | ||
! CHECK: exit from DO CONCURRENT construct \\(nc5: do concurrent\\(i5=1:n\\)\\) to construct with name 'mytest1' | ||
! CHECK: exit from DO CONCURRENT construct \\(nc3: do concurrent\\(i3=1:n\\)\\) to construct with name 'mytest1' | ||
! CHECK: exit from DO CONCURRENT construct \\(nc1: do concurrent\\(i1=1:n\\)\\) to construct with name 'mytest1' | ||
! CHECK: exit from DO CONCURRENT construct \\(nc5: do concurrent\\(i5=1:n\\)\\) to construct with name 'nc3' | ||
! CHECK: exit from DO CONCURRENT construct \\(nc3: do concurrent\\(i3=1:n\\)\\) to construct with name 'nc3' | ||
! CHECK: exit from DO CONCURRENT construct \\(nc3: do concurrent\\(i3=1:n\\)\\) to construct with name 'nc2' | ||
|
||
subroutine do_concurrent_test1(n) | ||
implicit none | ||
integer :: i1,i2,i3,i4,i5,i6,n | ||
mytest1: if (n>0) then | ||
nc1: do concurrent(i1=1:n) | ||
nc2: do i2=1,n | ||
nc3: do concurrent(i3=1:n) | ||
nc4: do i4=1,n | ||
nc5: do concurrent(i5=1:n) | ||
nc6: do i6=1,n | ||
if (i6==10) exit mytest1 | ||
end do nc6 | ||
end do nc5 | ||
end do nc4 | ||
end do nc3 | ||
end do nc2 | ||
end do nc1 | ||
end if mytest1 | ||
end subroutine do_concurrent_test1 | ||
|
||
subroutine do_concurrent_test2(n) | ||
implicit none | ||
integer :: i1,i2,i3,i4,i5,i6,n | ||
mytest2: if (n>0) then | ||
nc1: do concurrent(i1=1:n) | ||
nc2: do i2=1,n | ||
nc3: do concurrent(i3=1:n) | ||
nc4: do i4=1,n | ||
nc5: do concurrent(i5=1:n) | ||
nc6: do i6=1,n | ||
if (i6==10) exit nc3 | ||
end do nc6 | ||
end do nc5 | ||
end do nc4 | ||
end do nc3 | ||
end do nc2 | ||
end do nc1 | ||
end if mytest2 | ||
end subroutine do_concurrent_test2 | ||
|
||
subroutine do_concurrent_test3(n) | ||
implicit none | ||
integer :: i1,i2,i3,i4,i5,i6,n | ||
mytest3: if (n>0) then | ||
nc1: do concurrent(i1=1:n) | ||
nc2: do i2=1,n | ||
nc3: do concurrent(i3=1:n) | ||
if (i3==4) exit nc2 | ||
nc4: do i4=1,n | ||
nc5: do concurrent(i5=1:n) | ||
nc6: do i6=1,n | ||
if (i6==10) print *, "hello" | ||
end do nc6 | ||
end do nc5 | ||
end do nc4 | ||
end do nc3 | ||
end do nc2 | ||
end do nc1 | ||
end if mytest3 | ||
end subroutine do_concurrent_test3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
! Copyright (c) 2019, Arm Ltd. All rights reserved. | ||
! | ||
! Licensed under the Apache License, Version 2.0 (the "License"); | ||
! you may not use this file except in compliance with the License. | ||
! You may obtain a copy of the License at | ||
! | ||
! http://www.apache.org/licenses/LICENSE-2.0 | ||
! | ||
! Unless required by applicable law or agreed to in writing, software | ||
! distributed under the License is distributed on an "AS IS" BASIS, | ||
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
! See the License for the specific language governing permissions and | ||
! limitations under the License. | ||
|
||
! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s | ||
! CHECK-NOT: exit from DO CONCURRENT construct | ||
|
||
subroutine do_concurrent_test1(n) | ||
implicit none | ||
integer :: j,k,l,n | ||
mytest: if (n>0) then | ||
mydoc: do concurrent(j=1:n) | ||
mydo: do k=1,n | ||
if (k==5) exit | ||
if (k==6) exit mydo | ||
end do mydo | ||
do concurrent(l=1:n) | ||
if (l==5) print *, "test" | ||
end do | ||
end do mydoc | ||
do k=1,n | ||
if (k==5) exit mytest | ||
end do | ||
end if mytest | ||
end subroutine do_concurrent_test1 | ||
|
||
subroutine do_concurrent_test2(n) | ||
implicit none | ||
integer :: i1,i2,i3,i4,i5,i6,n | ||
mytest2: if (n>0) then | ||
nc1: do concurrent(i1=1:n) | ||
nc2: do i2=1,n | ||
nc3: do concurrent(i3=1:n) | ||
nc4: do i4=1,n | ||
if (i3==4) exit nc4 | ||
nc5: do concurrent(i5=1:n) | ||
nc6: do i6=1,n | ||
if (i6==10) print *, "hello" | ||
end do nc6 | ||
end do nc5 | ||
end do nc4 | ||
end do nc3 | ||
end do nc2 | ||
end do nc1 | ||
end if mytest2 | ||
end subroutine do_concurrent_test2 |