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
42 lines
855 B
Fortran
42 lines
855 B
Fortran
! 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
|