<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125443>125443</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation abnormally terminates when the array size is too large
</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(1c4341d176492da5f276937b84a3d0c959e4cf5b)/AArch64
```
In the attached program, when the array size is too large, a compilation terminates abnormally.
Gfortran and ifx output compilation messages and result in compilation errors.
flang should do the same thing as Gfortran and ifx.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
msg0520_.F90:
```fortran
character*32000,parameter::a(150000000000000)=""
character*32000,parameter::b(150000000000000)=""
character*1, parameter::c(150000000000000)=a//b
c='a'
print *,c(11)
end
```
```
$ flang msg0520_.F90
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 1c4341d176492da5f276937b84a3d0c959e4cf5b)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/groups/ssoft/compiler/llvm/aarch64/main-20250127-1c4341d17649/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/msg0520_-93ceaa
flang-20: note: diagnostic msg: /tmp/msg0520_-93ceaa.sh
flang-20: note: diagnostic msg:
********************
$
```
```
$ cat /tmp/msg0520_-93ceaa
#line "./msg0520_.F90" 1
character*32000,parameter::a(150000000000000)=""
character*32000,parameter::b(150000000000000)=""
character*1, parameter::c(150000000000000)=a//b
c='a'
print *,c(11)
end
$
```
```
$ cat /tmp/msg0520_-93ceaa.sh
# Crash reproducer for clang version 20.0.0git (https://github.com/llvm/llvm-project.git 1c4341d176492da5f276937b84a3d0c959e4cf5b)
# Driver args: "msg0520_.F90"
# Original command: "/work/groups/ssoft/compiler/llvm/aarch64/main-20250127-1c4341d17649/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-20250127-1c4341d17649/lib/clang/20" "-mframe-pointer=non-leaf" "-o" "/tmp/msg0520_-e41d69.o" "-x" "f95-cpp-input" "msg0520_.F90"
"/work/groups/ssoft/compiler/llvm/aarch64/main-20250127-1c4341d17649/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" "msg0520_-93ceaa"
$
```
```
$ gfortran msg0520_.F90
msg0520_.F90:1:51:
1 | character*32000,parameter::a(150000000000000)=""
| 1
Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’
msg0520_.F90:2:51:
2 | character*32000,parameter::b(150000000000000)=""
| 1
Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’
msg0520_.F90:3:51:
3 | character*1, parameter::c(150000000000000)=a//b
| 1
Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’
msg0520_.F90:5:16:
5 | print *,c(11)
| 1
Error: Syntax error in PRINT statement at (1)
msg0520_.F90:4:8:
4 | c='a'
| 1
Error: Cannot convert CHARACTER(1) to REAL(4) at (1)
$
```
```
$ ifx msg0520_.F90 -> Kill because compilation does not end after message output
msg0520_.F90(1): warning #8221: This integer constant is outside the default integer range - using INTEGER(8) instead. [150000000000000]
character*32000,parameter::a(150000000000000)=""
-----------------------------------^
msg0520_.F90(1): error #6258: The CHARACTER string result is greater than 7198 characters. [A]
character*32000,parameter::a(150000000000000)=""
---------------------------------^
msg0520_.F90(2): warning #8221: This integer constant is outside the default integer range - using INTEGER(8) instead. [150000000000000]
character*32000,parameter::b(150000000000000)=""
-----------------------------------^
msg0520_.F90(2): error #6258: The CHARACTER string result is greater than 7198 characters. [B]
character*32000,parameter::b(150000000000000)=""
---------------------------------^
msg0520_.F90(3): warning #8221: This integer constant is outside the default integer range - using INTEGER(8) instead. [150000000000000]
character*1, parameter::c(150000000000000)=a//b
-----------------------------------^
C-c C-c
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWV9zozgS_zTySxcuEGDDgx-IY8-kLjWZyvjuHq9kaEAzIFGScDL36a8kILHzZ5JsZndvt4YiFYxare5f_1MLpjWvBOKKxGckPp-x3tRSrWQtpFd-ne1l8X1FFv54-9m_UGkuBcgSyoaJCkiYAfXn_twnNAnyKIyCIlguopQWLC7pcpGGy30SsbDw8zROMcrLeE9oSug2y1ReLyLiZ_Y-WoT42YUAUyMwY1heYwGdkpViLaFruKlxHFSKfQfN_4vANRgpoWGqQkvDIJdtxxtmrLAGVcsFM6iB7YVULWua73MA4mcfSqmMYgKYKICXtyB70_XmZHqLWrPKThYFKNR9Y4CLExJUSio9sBxw0bXsmwIK6UTVrEUwNRcVMA0PF50POu9qhFI2jbxxdArdVIPaHKu_teztwyPRjwQidIu3mPdOuEHkcZFWV35M_f_Mt6lPwhPkR37Ez8Bdec0Uyw0qQrOQ-r5P6LpjirVo34UZCTNmjR77x5e1bXhOKLX3G1jtfwOrwOIAAA9Y5c-xYoRuCd3u75k5_ktG6PLuXae4MEBoRujacQrs5GkURfHYW09-0mgMjROoR7_wqEV98Bf70Au2bxCMhMFeaK3YMlHYwX_wpsHiuanDIqWSwqAopnlQMt5gAUXvuNroZg0QmvQ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