brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 25d34cc Raw
49 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12 3! Check for semantic errors in ALLOCATE statements4 5subroutine C943_C944(src, src2)6! C9437! No alloc-opt shall appear more than once in a given alloc-opt-list.8  character(50) msg9  integer stat, stat210  real src(2:4), src2(2:4)11  real mld(2:4), mld2(2:4)12  real, allocatable :: x1(:), x2(:), x3(:), x4(:), x5(:), x6(:), x7(:), x8(:), x9(:)13  real, allocatable :: y1(:), y2(:), y3(:), y4(:)14  real, pointer :: p1, p215 16  !Nominal cases, no error expected17  allocate(x1, source=src)18  allocate(x2, mold=mld)19  allocate(x3(2:4), stat=stat)20  allocate(x4(2:4), stat=stat, errmsg=msg)21  allocate(x5(2:4), source=src, stat=stat, errmsg=msg)22 23  !ERROR: STAT may not be duplicated in a ALLOCATE statement24  allocate(x6, stat=stat, source=src, stat=stat2)25 26  !ERROR: SOURCE may not be duplicated in a ALLOCATE statement27  allocate(x7, source=src, stat=stat, source=src2)28 29  !ERROR: MOLD may not be duplicated in a ALLOCATE statement30  allocate(x8, mold=mld, stat=stat, mold=mld)31 32  !ERROR: ERRMSG may not be duplicated in a ALLOCATE statement33  allocate(x9, mold=mld, errmsg=msg, stat=stat, errmsg= msg)34 35! C94436! At most one of source-expr and type-spec must appear.37 38  !Nominal cases already tested in C943 and type-spec tests (e.g C934)39 40  !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement41  allocate(real:: y1, source=src)42  !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement43  allocate(real:: y2, mold=mld)44  !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement45  allocate(y3, source=src, stat=stat, errmsg=msg, mold=mld)46  !ERROR: At most one of source-expr and type-spec may appear in a ALLOCATE statement47  allocate(real:: y4, source=src, stat=stat, errmsg=msg, mold=mld)48end subroutine49