Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added OpenMP 5.0 specification based semantic checks for CRITICAL con…
…struct name resolution As reported in https://bugs.llvm.org/show_bug.cgi?id=48145, name resolution for omp critical construct was failing. This patch adds functionality to help that name resolution as well as implementation to catch name mismatches. The following semantic restrictions are therefore handled here: - If a name is specified on a critical directive, the same name must also be specified on the end critical directive - If no name appears on the critical directive, no name can appear on the end critical directive - If a name appears on either the start critical directive or the end critical directive Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D110502
- Loading branch information
1 parent
098a0d8
commit fe2d053
Showing
7 changed files
with
153 additions
and
4 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
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
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,41 @@ | ||
! RUN: %python %S/test_errors.py %s %flang -fopenmp | ||
|
||
! OpenMP Version 5.0 | ||
! 2.17.1 critical construct | ||
! CRITICAL start and end CRITICAL directive names mismatch | ||
integer function timer_tick_sec() | ||
implicit none | ||
integer t | ||
|
||
!$OMP CRITICAL | ||
t = t + 1 | ||
!$OMP END CRITICAL | ||
|
||
!$OMP CRITICAL (foo) | ||
t = t + 1 | ||
!$OMP END CRITICAL (foo) | ||
|
||
!$OMP CRITICAL (foo) | ||
t = t + 1 | ||
!ERROR: CRITICAL directive names do not match | ||
!$OMP END CRITICAL (bar) | ||
|
||
!$OMP CRITICAL (bar) | ||
t = t + 1 | ||
!ERROR: CRITICAL directive names do not match | ||
!$OMP END CRITICAL (foo) | ||
|
||
!ERROR: CRITICAL directive names do not match | ||
!$OMP CRITICAL (bar) | ||
t = t + 1 | ||
!$OMP END CRITICAL | ||
|
||
!$OMP CRITICAL | ||
t = t + 1 | ||
!ERROR: CRITICAL directive names do not match | ||
!$OMP END CRITICAL (foo) | ||
|
||
timer_tick_sec = t | ||
return | ||
|
||
end function timer_tick_sec |
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,53 @@ | ||
! RUN: %python %S/test_errors.py %s %flang -fopenmp | ||
|
||
! OpenMP Version 5.0 | ||
! 2.17.1 critical construct | ||
! If the hint clause is specified, the critical construct must have a name. | ||
program sample | ||
use omp_lib | ||
integer i, j | ||
!ERROR: Hint clause other than omp_sync_hint_none cannot be specified for an unnamed CRITICAL directive | ||
!$omp critical hint(omp_lock_hint_speculative) | ||
j = j + 1 | ||
!$omp end critical | ||
|
||
!$omp critical (foo) hint(omp_lock_hint_speculative) | ||
i = i - 1 | ||
!$omp end critical (foo) | ||
|
||
!ERROR: Hint clause other than omp_sync_hint_none cannot be specified for an unnamed CRITICAL directive | ||
!$omp critical hint(omp_lock_hint_nonspeculative) | ||
j = j + 1 | ||
!$omp end critical | ||
|
||
!$omp critical (foo) hint(omp_lock_hint_nonspeculative) | ||
i = i - 1 | ||
!$omp end critical (foo) | ||
|
||
!ERROR: Hint clause other than omp_sync_hint_none cannot be specified for an unnamed CRITICAL directive | ||
!$omp critical hint(omp_lock_hint_contended) | ||
j = j + 1 | ||
!$omp end critical | ||
|
||
!$omp critical (foo) hint(omp_lock_hint_contended) | ||
i = i - 1 | ||
!$omp end critical (foo) | ||
|
||
!ERROR: Hint clause other than omp_sync_hint_none cannot be specified for an unnamed CRITICAL directive | ||
!$omp critical hint(omp_lock_hint_uncontended) | ||
j = j + 1 | ||
!$omp end critical | ||
|
||
!$omp critical (foo) hint(omp_lock_hint_uncontended) | ||
i = i - 1 | ||
!$omp end critical (foo) | ||
|
||
!$omp critical hint(omp_sync_hint_none) | ||
j = j + 1 | ||
!$omp end critical | ||
|
||
!$omp critical (foo) hint(omp_sync_hint_none) | ||
i = i - 1 | ||
!$omp end critical (foo) | ||
|
||
end program sample |