-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Description
The following invalid OpenMP program causes a compiler crash rather than emitting a semantics error:
! test.f90
program main
implicit none
integer, parameter :: n = 100
integer, parameter :: expected = n+2
integer :: i
integer :: counter
counter = 0
!$omp target map(tofrom:counter)
counter = counter+1
!$omp teams distribute reduction(+:counter)
do i=1, n
counter = counter+1
end do
counter = counter+1
!$omp end target
print '("Result: "I0)', counter
end program
This is triggered both when offloading and when compiling exclusively for the host device.
flang -fopenmp --offload-arch=gfx1030 test.f90
flang -fopenmp test.f90
The specific OpenMP restriction being violated by the previous example is found in the specification version 6.0, page 395, lines 33 -- 35:
[...] If a
teams
region is nested inside atarget
region, the correspondingtarget
construct must not contain any statements, declarations or directives outside of the correspondingteams
construct.