Issue 148258
Summary [flang] Unexpected runtime failure when allocating a zero-sized array
Labels flang:runtime
Assignees
Reporter DanielCChen
    Consider the following code

```
real, allocatable :: r1(:)
call sub(r1, [real :: ], 0)

contains
subroutine sub(obj, source, size)
real, allocatable :: obj(:)
real :: source(size)
integer :: size

allocate(obj, source=source)
print*, allocated(r1)

end subroutine
end
```

Flang failed at runtime with
```
> a.out

fatal Fortran runtime error(t.f:2): Assign: left-hand side variable is neither allocated nor allocatable
IOT/Abort trap(coredump)
```

Flang supports allocating zero-sized array as shown in issue #148255, this variation should also be supported.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to