anchor.diff:      sync all
       if (me == 2) then
         print *, obj%int_k4
  -      if (any(obj%int_k4 /= INT(real_scal_k4, 4))) error stop 'send real scal kind=4 to int array kind=4 to image 2 failed.'
  -
  -      print *, obj%int_k1
  -      if (any(obj%int_k1 /= INT(real_scal_k4, 1))) error stop 'send real scal kind=1 to int array kind=1 to image 2 failed.'
  -
  -      print *, obj%real_k8
  -      if (any(abs(obj%real_k8 - int_scal_k4) > tolerance4to8)) error stop 'send int kind=4 to real array kind=8 to image 2 failed.'
  -
  -      print *, obj%real_k4
  -      if (any(abs(obj%real_k4 - int_scal_k4) > tolerance4)) error stop 'send int kind=4 to real array kind=4 to image 2 failed.'
  +      if (any(obj%int_k4 /= INT(real_scal_k4, 4))) &
  +        call print_and_register( 'send real scal kind=4 to int array kind=4 to image 2 failed')
  +
  +      print *, obj%int_k1
  +      if (any(obj%int_k1 /= INT(real_scal_k4, 1))) &
  +        call print_and_register( 'send real scal kind=1 to int array kind=1 to image 2 failed')
  +
  +      print *, obj%real_k8
  +      if (any(abs(obj%real_k8 - int_scal_k4) > tolerance4to8)) &
  +        call print_and_register( 'send int kind=4 to real array kind=8 to image 2 failed')
  +
  +      print *, obj%real_k4
  +      if (any(abs(obj%real_k4 - int_scal_k4) > tolerance4)) &
  +        call print_and_register( 'send int kind=4 to real array kind=4 to image 2 failed')
       end if
   
       ! Now with strides
  
positive.code:     sync all
      if (me == 2) then
        print *, obj%int_k4
        if (any(obj%int_k4 /= [15, -1, 13, -1, 11])) error stop 'strided send int kind=4 to kind=4 to image 2 failed.'
  
        print *, obj%int_k1
        if (any(obj%int_k1 /= [INT(-15, 1), INT(-1, 1), INT(-13, 1), INT(-1, 1), INT(-11, 1)])) &
          & error stop 'strided send int kind=1 to kind=1 to image 2 failed.'
  
        print *, obj%real_k8
        if (any(abs(obj%real_k8 - [1.3, -1.0, 1.5, -1.0, 1.7]) > tolerance8)) &
          & error stop 'strided send real kind=8 to kind=8 to image 2 failed.'
  
        print *, obj%real_k4
        if (any(abs(obj%real_k4 - [REAL(1.3, 4), REAL(-1.0, 4), REAL(1.5, 4), REAL(-1.0, 4), REAL(1.7, 4)]) > tolerance4)) &
          & error stop 'strided send real kind=4 to kind=4 to image 2 failed.'
      end if
      
      ! now with strides and kind conversion
      sync all
      obj%int_k4 = -1
  
negative.code:     sync all
      if (me == 2) then
        print *, obj%int_k4
        if (any(obj%int_k4 /= [15, -1, 13, -1, 11])) &
          call print_and_register( 'strided send real kind=4 to int kind=4 to image 2 failed')
  
        print *, obj%int_k1
        if (any(obj%int_k1 /= [INT(-15, 1), INT(-1, 1), INT(-13, 1), INT(-1, 1), INT(-11, 1)])) &
            call print_and_register( 'strided send int real kind=4 to int kind=1 to image 2 failed')
  
        print *, obj%real_k8
        if (any(abs(obj%real_k8 - [13.0, -1.0, 15.0, -1.0, 17.0]) > tolerance8)) &
            call print_and_register( 'strided send int kind=4 to real kind=8 to image 2 failed')
  
        print *, obj%real_k4
        if (any(abs(obj%real_k4 - [REAL(23, 4), REAL(-1.0, 4), REAL(25, 4), REAL(-1.0, 4), REAL(27, 4)]) > tolerance4)) &
            call print_and_register( 'strided send int kind=4 to real kind=4 to image 2 failed')
      end if
  
      sync all
      if (me == 1) print *, "Test passed."
    end associate
  
  contains
  
    subroutine print_and_register(error_message)
      use iso_fortran_env, only : error_unit
      character(len=*), intent(in) :: error_message
      write(error_unit,*) error_message
      error_printed=.true.
    end subroutine
  
  end program alloc_comp_send_convert_nums
  
  ! vim:ts=2:sts=2:sw=2:
  