! RUN: %python %S/test_errors.py %s %flang_fc1

module dev
  integer, device :: syncthreads

contains

  attributes(device) subroutine sub1()
    syncthreads = 1 ! syncthreads not overwritten by cudadevice
  end subroutine

  attributes(global) subroutine sub2()
!ERROR: 'threadfence' is use-associated from module 'cudadevice' and cannot be re-declared
    integer :: threadfence
  end subroutine

  attributes(host,device) subroutine sub3()
    if (on_device()) then
      print*, 'on device'
    else
      print*, 'on host'
    end if
  end subroutine

  attributes(grid_global) subroutine sub4()
    call threadfence()
  end subroutine
end module

