12944f8efSKatherine Rasmussen! RUN: %python %S/test_errors.py %s %flang_fc1 22944f8efSKatherine Rasmussen! Check for semantic errors in move_alloc() subroutine calls 32944f8efSKatherine Rasmussenprogram main 4*f9b089a7SPeter Klausler integer, allocatable :: a(:)[:], b(:)[:], f(:), g(:) 5*f9b089a7SPeter Klausler type alloc_component 6*f9b089a7SPeter Klausler integer, allocatable :: a(:) 7*f9b089a7SPeter Klausler end type 8*f9b089a7SPeter Klausler type(alloc_component) :: c[*], d[*] 92944f8efSKatherine Rasmussen !ERROR: 'e' is an ALLOCATABLE coarray and must have a deferred coshape 102944f8efSKatherine Rasmussen integer, allocatable :: e(:)[*] 112944f8efSKatherine Rasmussen integer status, coindexed_status[*] 122944f8efSKatherine Rasmussen character(len=1) message, coindexed_message[*] 13a6935cfeSPeter Klausler integer :: nonAllocatable(10) 14a6935cfeSPeter Klausler type t 15a6935cfeSPeter Klausler end type 16a6935cfeSPeter Klausler class(t), allocatable :: t1 17a6935cfeSPeter Klausler type(t), allocatable :: t2 18d9232e39SPeter Klausler character, allocatable :: ca*2, cb*3 192944f8efSKatherine Rasmussen 202944f8efSKatherine Rasmussen ! standards conforming 212944f8efSKatherine Rasmussen allocate(a(3)[*]) 222944f8efSKatherine Rasmussen a = [ 1, 2, 3 ] 232944f8efSKatherine Rasmussen call move_alloc(a, b, status, message) 242944f8efSKatherine Rasmussen 252944f8efSKatherine Rasmussen !ERROR: too many actual arguments for intrinsic 'move_alloc' 262944f8efSKatherine Rasmussen call move_alloc(a, b, status, message, 1) 272944f8efSKatherine Rasmussen 282944f8efSKatherine Rasmussen ! standards non-conforming 292944f8efSKatherine Rasmussen !ERROR: 'from' argument to 'move_alloc' may not be a coindexed object 30*f9b089a7SPeter Klausler call move_alloc(c[1]%a, f) 312944f8efSKatherine Rasmussen 322944f8efSKatherine Rasmussen !ERROR: 'to' argument to 'move_alloc' may not be a coindexed object 33*f9b089a7SPeter Klausler call move_alloc(f, d[1]%a) 342944f8efSKatherine Rasmussen 352944f8efSKatherine Rasmussen !ERROR: 'stat' argument to 'move_alloc' may not be a coindexed object 36*f9b089a7SPeter Klausler call move_alloc(f, g, coindexed_status[1]) 372944f8efSKatherine Rasmussen 382944f8efSKatherine Rasmussen !ERROR: 'errmsg' argument to 'move_alloc' may not be a coindexed object 39*f9b089a7SPeter Klausler call move_alloc(f, g, status, coindexed_message[1]) 402944f8efSKatherine Rasmussen 412944f8efSKatherine Rasmussen !ERROR: 'errmsg' argument to 'move_alloc' may not be a coindexed object 42*f9b089a7SPeter Klausler call move_alloc(f, g, errmsg=coindexed_message[1]) 432944f8efSKatherine Rasmussen 442944f8efSKatherine Rasmussen !ERROR: 'errmsg' argument to 'move_alloc' may not be a coindexed object 45*f9b089a7SPeter Klausler call move_alloc(f, g, errmsg=coindexed_message[1], stat=status) 462944f8efSKatherine Rasmussen 472944f8efSKatherine Rasmussen !ERROR: 'stat' argument to 'move_alloc' may not be a coindexed object 48*f9b089a7SPeter Klausler call move_alloc(f, g, stat=coindexed_status[1]) 492944f8efSKatherine Rasmussen 502944f8efSKatherine Rasmussen !ERROR: 'stat' argument to 'move_alloc' may not be a coindexed object 51*f9b089a7SPeter Klausler call move_alloc(f, g, errmsg=message, stat=coindexed_status[1]) 522944f8efSKatherine Rasmussen 532944f8efSKatherine Rasmussen !ERROR: 'from' argument to 'move_alloc' may not be a coindexed object 542944f8efSKatherine Rasmussen !ERROR: 'to' argument to 'move_alloc' may not be a coindexed object 552944f8efSKatherine Rasmussen !ERROR: 'stat' argument to 'move_alloc' may not be a coindexed object 562944f8efSKatherine Rasmussen !ERROR: 'errmsg' argument to 'move_alloc' may not be a coindexed object 57*f9b089a7SPeter Klausler call move_alloc(c[1]%a, d[1]%a, stat=coindexed_status[1], errmsg=coindexed_message[1]) 582944f8efSKatherine Rasmussen 59a6935cfeSPeter Klausler !ERROR: Argument #1 to MOVE_ALLOC must be allocatable 60a6935cfeSPeter Klausler call move_alloc(nonAllocatable, f) 61a6935cfeSPeter Klausler !ERROR: Argument #2 to MOVE_ALLOC must be allocatable 62a6935cfeSPeter Klausler call move_alloc(f, nonAllocatable) 63a6935cfeSPeter Klausler 64a6935cfeSPeter Klausler !ERROR: When MOVE_ALLOC(FROM=) is polymorphic, TO= must also be polymorphic 65a6935cfeSPeter Klausler call move_alloc(t1, t2) 66a6935cfeSPeter Klausler call move_alloc(t2, t1) ! ok 67a6935cfeSPeter Klausler 68d9232e39SPeter Klausler !ERROR: Actual argument for 'to=' has bad type or kind 'CHARACTER(KIND=1,LEN=3_8)' 69d9232e39SPeter Klausler call move_alloc(ca, cb) 70d9232e39SPeter Klausler 71*f9b089a7SPeter Klausler !ERROR: Argument #1 to MOVE_ALLOC must be allocatable 72*f9b089a7SPeter Klausler call move_alloc(f(::2), g) 73*f9b089a7SPeter Klausler !ERROR: Argument #2 to MOVE_ALLOC must be allocatable 74*f9b089a7SPeter Klausler call move_alloc(f, g(::2)) 75*f9b089a7SPeter Klausler 762944f8efSKatherine Rasmussenend program main 77