brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 85cd181 Raw
156 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror2 3!WARNING: Function result is never defined [-Wundefined-function-result]4function basic()5end6 7function defdByIntentOut()8  call intentout(defdByIntentOut)9 contains10  subroutine intentout(x)11    real, intent(out) :: x12  end13end14 15function defdByIntentInOut()16  call intentinout(defdByIntentInOut)17 contains18  subroutine intentInout(x)19    real, intent(out) :: x20  end21end22 23function defdByIntentInPtr()24  real, target :: defdByIntentInPtr25  call intentInPtr(defdByIntentInPtr)26 contains27  subroutine intentInPtr(p)28    real, intent(in), pointer :: p29  end30end31 32!WARNING: Function result is never defined [-Wundefined-function-result]33function notDefdByCall()34  call intentin(notDefdByCall)35 contains36  subroutine intentin(n)37    integer, intent(in) :: n38  end39end40 41!WARNING: Function result is never defined [-Wundefined-function-result]42function basicAlloc()43  real, allocatable :: basicAlloc44  allocate(basicAlloc)45end46 47function allocPtr()48  real, pointer :: allocPtr49  allocate(allocPtr) ! good enough for pointer50end51 52function sourcedAlloc()53  real, allocatable :: sourcedAlloc54  allocate(sourcedAlloc, source=0.)55end56 57function defdByEntry()58  entry entry159  entry1 = 0.60end61 62function defdByEntry2()63  entry entry2() result(entryResult)64  entryResult = 0.65end66 67function usedAsTarget()68  real, target :: usedAsTarget69  real, pointer :: p70  p => usedAsTarget71end72 73function entryUsedAsTarget()74  real, target :: entryResult75  real, pointer :: p76  entry entry5() result(entryResult)77  p => entryResult78end79 80function defdByCall()81  call implicitInterface(defdByCall)82end83 84function defdInInternal()85 contains86  subroutine internal87    defdInInternal = 0.88  end89end90 91function defdByEntryInInternal()92  entry entry3() result(entryResult)93 contains94  subroutine internal95    entryResult = 0.96  end97end98 99type(defaultInitialized) function defdByDefault()100  type defaultInitialized101    integer :: n = 123102  end type103end104 105integer function defdByDo()106  do defdByDo = 1, 10107  end do108end109 110function defdByRead()111  read(*,*) defdByRead112end function113 114function defdByNamelist()115  namelist /nml/ defdByNamelist116  read(*,nml=nml)117end118 119character(4) function defdByWrite()120  write(defdByWrite,*) 'abcd'121end122 123integer function defdBySize()124  real arr(10)125  read(*,size=defdBySize) arr126end127 128character(40) function defdByIomsg()129  !WARNING: IOMSG= is useless without either ERR= or IOSTAT=130  write(123,*,iomsg=defdByIomsg)131end132 133character(20) function defdByInquire()134  inquire(6,status=defdByInquire)135end136 137!WARNING: Function result is never defined [-Wundefined-function-result]138character(20) function notDefdByInquire()139  inquire(file=notDefdByInquire)140end141 142integer function defdByNewunit()143  open(newunit=defdByNewunit, file="foo.txt")144end145 146function defdByAssociate()147  associate(s => defdByAssociate)148    s = 1.149  end associate150end151 152function defdByElementArgToImplicit() result(r)153  real r(1)154  call define(r(1))155end156