| Issue |
240759
|
| Summary |
[Flang] Excessive memory usage during constant folding of oversized DATA initialization
|
| Labels |
flang
|
| Assignees |
|
| Reporter |
blazie2004
|
## Description
Flang can consume excessive memory and terminate while compiling a DATA statement that initializes a large array component of a derived type using a scalar constant.
The expected behavior is to report the existing oversized DATA initialization diagnostic rather than attempting to materialize the entire array during constant folding.
## Reproducer
```fortran
subroutine oversized_data_init
implicit none
type :: payload
real :: marker
complex :: values(999999999)
end type
type(payload) :: item
data item / payload(-1.1, (1.0, 2.0)) /
end subroutine
```
Compile with:
```bash
flang -fsyntax-only repro.f90
```
## Expected Behavior
Flang should report a controlled diagnostic similar to:
```text
error: not yet implemented: 'item' is too large to initialize with a DATA statement
```
## Actual Behavior
```text
flang-24: error: unable to execute command: Killed
flang-24: error: flang frontend command failed with exit code -2
```
During constant folding, Flang eagerly expands a scalar complex constant into a huge array, causing excessive memory allocation.
The existing DATA initialization size check runs too late, so the frontend runs out of memory before reporting the expected diagnostic.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs