! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
include "cuf-sanity-common"
!CHECK: SUBROUTINE atcuf
!CHECK: END SUBROUTINE
!CHECK: SUBROUTINE cudadefd
!CHECK: END SUBROUTINE
!CHECK: MODULE m
!CHECK: REAL, ALLOCATABLE, PINNED :: pa(:)
!CHECK: CONTAINS
!CHECK: ATTRIBUTES(DEVICE) SUBROUTINE devicesub
!CHECK: END SUBROUTINE
!CHECK: ATTRIBUTES(DEVICE) REAL FUNCTION devicefunc()
!CHECK: devicefunc=1._4
!CHECK: END FUNCTION
!CHECK: ATTRIBUTES(GLOBAL) SUBROUTINE globalsub
!CHECK: END SUBROUTINE
!CHECK: ATTRIBUTES(GRID_GLOBAL) SUBROUTINE gridglobalsub
!CHECK: END SUBROUTINE
!CHECK: ATTRIBUTES(HOST) SUBROUTINE hostsub
!CHECK: END SUBROUTINE
!CHECK: ATTRIBUTES(GLOBAL) LAUNCH_BOUNDS(1_4, 2_4) SUBROUTINE lbsub
!CHECK: END SUBROUTINE
!CHECK: ATTRIBUTES(GLOBAL) CLUSTER_DIMS(1_4, 2_4, 3_4) SUBROUTINE cdsub
!CHECK: END SUBROUTINE
!CHECK: ATTRIBUTES(DEVICE) SUBROUTINE attrs
!CHECK: ATTRIBUTES(DEVICE) devx1
!CHECK: REAL, DEVICE :: devx2
!CHECK: END SUBROUTINE
!CHECK: SUBROUTINE test
!CHECK: LOGICAL ispinned
!CHECK: !$CUF KERNEL DO (1_4) <<<*,*,STREAM=1_4>>>
!CHECK: DO j=1_4,10_4
!CHECK: END DO
!CHECK: !$CUF KERNEL DO <<<1_4,(2_4,3_4),STREAM=1_4>>>
!CHECK: DO j=1_4,10_4
!CHECK: END DO
!CHECK: !$CUF KERNEL DO <<<*,*>>> REDUCE(+:x,y) REDUCE(*:z)
!CHECK: DO j=1_4,10_4
!CHECK: x=x+a(int(j,kind=8))
!CHECK: y=y+a(int(j,kind=8))
!CHECK: z=z*a(int(j,kind=8))
!CHECK: END DO
!CHECK: CALL globalsub<<<1_4,2_4>>>()
!CHECK: CALL globalsub<<<1_4,2_4,3_4>>>()
!CHECK: CALL globalsub<<<1_4,2_4,3_4,4_4>>>()
!CHECK: ALLOCATE(pa(32_4), PINNED=ispinned)
!CHECK: END SUBROUTINE
!CHECK: END MODULE