Issue 76325
Summary [Flang] DEALLOCATE(name-list, STAT=iostat), when some in name-list are allocated and some not, does not deallocate an allocated name that occurs after the first not-allocated name.
Labels flang
Assignees
Reporter chandankds
    Partially successful DEALLOCATE with STAT= specifier should deallocate all names that can be deallocated.

The GNU and Intel compilers are also lazy like that.

Testcase

```
Program test_deallocate_some
 Integer, Allocatable :: x1(:),x2(:),x3(:)
  Integer::istat
  Allocate (x1(10),x2(4),x3(5))
10  Deallocate(x2)
20 Deallocate(x1,x2,x3,stat=istat) ! istat non-zero because x2 is deallocated
  If (istat==0) Print *, "bug STAT"
  If (Allocated(x1)) Print *,"bug x1" ! x1 should have been deallocated at 20
  If (Allocated(x2)) Print *,"bug x2" ! x2 was deallocated at 10
  If (Allocated(x3)) Print *,"bug x3" ! x3 should have been deallocated att 20
End Program test_deallocate_some
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to