[Flang] [OpenMP] Allow any type as argument to the FlushOp (#143844)

Fixes: #143842
This commit is contained in:
Thirumalai Shaktivel
2025-06-13 09:35:48 +05:30
committed by GitHub
parent 9992668404
commit 4268360003
2 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
! This test checks lowering of OpenMP Flush Directive.
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
module flush02_mod
type t1
integer(kind=4) :: x = 4
end type t1
type :: t2
type(t1) :: y = t1(2)
end type t2
contains
subroutine sub01(pt)
class(t1), intent(inout) :: pt
type(t2) :: dt
integer, allocatable :: a(:)
integer, pointer :: b(:)
! CHECK: omp.flush({{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>)
! CHECK: omp.flush({{.*}} : !fir.ref<f32>)
! CHECK: omp.flush({{.*}} : !fir.ref<!fir.type<_QMflush02_modTt2{y:!fir.type<_QMflush02_modTt1{x:i32}>}>>)
! CHECK: omp.flush({{.*}} : !fir.class<!fir.type<_QMflush02_modTt1{x:i32}>>)
!$omp flush(a)
!$omp flush(p)
!$omp flush(dt)
!$omp flush(pt)
end subroutine
end module flush02_mod

View File

@@ -889,7 +889,7 @@ def FlushOp : OpenMP_Op<"flush", clauses = [
specified or implied.
}] # clausesDescription;
let arguments = !con((ins Variadic<OpenMP_PointerLikeType>:$varList),
let arguments = !con((ins Variadic<AnyType>:$varList),
clausesArgs);
// Override inherited assembly format to include `varList`.