54 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Tests for UNIT=function()3module m14 integer, target :: itarget5 character(20), target :: ctarget6 logical, target :: ltarget7 interface gf8 module procedure :: intf, pintf, pchf, logf, plogf9 end interface10 contains11 integer function intf(n)12 integer(1), intent(in) :: n13 intf = n14 end function15 function pintf(n)16 integer(2), intent(in) :: n17 integer, pointer :: pintf18 pintf => itarget19 pintf = n20 end function21 function pchf(n)22 integer(4), intent(in) :: n23 character(:), pointer :: pchf24 pchf => ctarget25 end function26 logical function logf(n)27 integer(8), intent(in) :: n28 logf = .true.29 end function30 function plogf(n)31 integer(16), intent(in) :: n32 logical, pointer :: plf33 plf => ltarget34 end function35 subroutine test36 write(intf(6_1),"('hi')")37 write(pintf(6_2),"('hi')")38 write(pchf(123_4),"('hi')")39 write(gf(6_1),"('hi')")40 write(gf(6_2),"('hi')")41 write(gf(666_4),"('hi')")42 !ERROR: I/O unit must be a character variable or a scalar integer expression43 write(logf(666_8),"('hi')")44 !ERROR: I/O unit must be a character variable or a scalar integer expression45 write(plogf(666_16),"('hi')")46 !ERROR: I/O unit must be a character variable or a scalar integer expression47 write(gf(666_8),"('hi')")48 !ERROR: I/O unit must be a character variable or a scalar integer expression49 write(gf(666_16),"('hi')")50 !ERROR: I/O unit must be a character variable or a scalar integer expression51 write(null(),"('hi')")52 end subroutine53end module54