<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123536>123536</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation abnormally terminates when the array extent is set to a large value
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang : 20.0.0(f5a35a31bfe6cbc16bec0c130f2bb3632dbf1fbf)/AArch64
```
When the array extent is set to a large value, a compilation terminates abnormally.
Gfortran and ifx detect errors during compilation.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
e8643a_.f:
```fortran
recursive subroutine sub
parameter (i=1500000000)
real a(i,i),b(i,i)
a=1.0
b=1.0
print *,a,b
end
```
```
$ flang -c e8643a_.f
flang-20: error: unable to execute command: Killed
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git (https://github.com/llvm/llvm-project.git f5a35a31bfe6cbc16bec0c130f2bb3632dbf1fbf)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/groups/ssoft/compiler/llvm/aarch64/main-20250113-f5a35a31bfe6/bin
Build config: +assertions
flang-20: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-20: note: diagnostic msg: /tmp/e8643a_-f0d1aa
flang-20: note: diagnostic msg: /tmp/e8643a_-f0d1aa.sh
flang-20: note: diagnostic msg:
********************
$
```
```
$ cat /tmp/e8643a_-f0d1aa
#line "./e8643a_.f" 1
recursive subroutine sub
parameter (i=1500000000)
real a(i,i),b(i,i)
a=1.0
b=1.0
print *,a,b
end
$
```
```
$ cat /tmp/e8643a_-f0d1aa.sh
# Crash reproducer for clang version 20.0.0git (https://github.com/llvm/llvm-project.git f5a35a31bfe6cbc16bec0c130f2bb3632dbf1fbf)
# Driver args: "-c" "e8643a_.f"
# Original command: "/work/groups/ssoft/compiler/llvm/aarch64/main-20250113-f5a35a31bfe6/bin/flang" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-target-cpu" "generic" "-target-feature" "+outline-atomics" "-target-feature" "+v8a" "-target-featur
e" "+fp-armv8" "-target-feature" "+neon" "-resource-dir" "/work/groups/ssoft/compiler/llvm/aarch64/main-20250113-f5a35a31bfe6/lib/clang/20" "-mframe-pointer=non-leaf" "-o" "e8643a_.o" "-x" "f95-cpp-input" "e8643a_.f"
"/work/groups/ssoft/compiler/llvm/aarch64/main-20250113-f5a35a31bfe6/bin/flang" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-target-cpu" "generic" "-target-feature" "+outline-atomics" "-target-feature" "+v8a" "-target-feature" "+fp-armv8" "-tar
get-feature" "+neon" "-mframe-pointer=non-leaf" "-x" "f95-cpp-input" "e8643a_-f0d1aa"
$
```
```
$ gfortran -c e8643a_.f
e8643a_.f:1:30:
1 | recursive subroutine sub
| ^
Error: total size of local objects 18000000000000000000 exceeds maximum 9223372036854775296
$
```
```
$ ifx -c e8643a_.f
warning: <unknown>:0:0: stack frame size (4164941944717836440) exceeds limit (4294967295) in function 'sub_'
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsV0tv3DgS_jXsS0ENiZT6ceiD3LYywQbrYMa7cxxQVFHNhCIFkmo7--sX1MPd62TGDrKDuYxgoymxSNbjq69Y3HvVGsQDKW5IcbviQzhZd7AnYxP5aVXb5suBbNL5Ly3_jc4ra8BKkJqbFggrgabrdJ0SupMFZwVnWS1xI2qRbWoUqchYKmldsw2jTS0zWUtC94RWZenEaZOTtLw-gaTlryc0EE4I3Dn-BfApoAmgPHgMECxw0Ny1CGeuByT0CByE7XqleYi6BXSdMjygB14b6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