brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · a97cf5a Raw
57 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in ALLOCATE statements3 4program allocate145  6  integer, allocatable :: i1, i27  character(200), allocatable :: msg1, msg28  type t9    integer, allocatable :: i10    character(10), allocatable :: msg11  end type t12  type(t) :: tt(2)13  type(t), allocatable :: ts(:)14 15  allocate(i1)16  allocate(msg1)17 18  allocate(i2, stat=i1, errmsg=msg1)19  allocate(msg2, stat=i1, errmsg=msg1)20  deallocate(i2, stat=i1, errmsg=msg1)21  deallocate(msg2, stat=i1, errmsg=msg1)22 23  !ERROR: STAT variable in ALLOCATE must not be the variable being allocated24  allocate(i2, stat=i2, errmsg=msg2)25  !ERROR: ERRMSG variable in ALLOCATE must not be the variable being allocated26  allocate(msg2, stat=i2, errmsg=msg2)27  !ERROR: STAT variable in DEALLOCATE must not be the variable being deallocated28  deallocate(i2, stat=i2, errmsg=msg2)29  !ERROR: ERRMSG variable in DEALLOCATE must not be the variable being deallocated30  deallocate(msg2, stat=i2, errmsg=msg2)31 32  allocate(tt(1)%i)33  allocate(tt(1)%msg)34 35  allocate(tt(2)%i, stat=tt(1)%i, errmsg=tt(1)%msg)36  allocate(tt(2)%msg, stat=tt(1)%i, errmsg=tt(1)%msg)37  deallocate(tt(2)%i, stat=tt(1)%i, errmsg=tt(1)%msg)38  deallocate(tt(2)%msg, stat=tt(1)%i, errmsg=tt(1)%msg)39 40  !ERROR: STAT variable in ALLOCATE must not be the variable being allocated41  allocate(tt(2)%i, stat=tt(2)%i, errmsg=tt(2)%msg)42  !ERROR: ERRMSG variable in ALLOCATE must not be the variable being allocated43  allocate(tt(2)%msg, stat=tt(2)%i, errmsg=tt(2)%msg)44  !ERROR: STAT variable in DEALLOCATE must not be the variable being deallocated45  deallocate(tt(2)%i, stat=tt(2)%i, errmsg=tt(2)%msg)46  !ERROR: ERRMSG variable in DEALLOCATE must not be the variable being deallocated47  deallocate(tt(2)%msg, stat=tt(2)%i, errmsg=tt(2)%msg)48 49  !TODO: STAT variable in ALLOCATE must not be the variable being allocated50  !TODO: ERRMSG variable in ALLOCATE must not be the variable being allocated51  allocate(ts(10), stat=ts(1)%i, errmsg=ts(1)%msg)52  !TODO: STAT variable in DEALLOCATE must not be the variable being deallocated53  !TODO: ERRMSG variable in DEALLOCATE must not be the variable being deallocated54  deallocate(ts, stat=ts(1)%i, errmsg=ts(1)%msg)55end program56 57