<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63247>63247</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] flang-new crashes (gfortran/regression/g77/19990905-1.f)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Crashed by the following test program (https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/g77/19990905-1.f is the original)
```console
$ cat test.f
subroutine x
real a(n)
common /foo/n
continue
entry y(a)
call foo(a(1))
end
```
Error message:
```console
error: loc("./test.f":6:12): redefinition of symbol named 'foo_'
error: Lowering to LLVM IR failed
error: loc("./test.f":3:15): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: fir.global
```
Stack dump:
```console
#0 0x000055d6da2c0768 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
#1 0x000055d6da2be6de llvm::sys::RunSignalHandlers()
#2 0x000055d6da2c1098 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f65cd547520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000055d6dd7f2559 llvm::Module::setPICLevel(llvm::PICLevel::Level)
#5 0x000055d6da4cb500 Fortran::frontend::CodeGenAction::generateLLVMIR()
#6 0x000055d6da4cd4e0 Fortran::frontend::CodeGenAction::executeAction()
#7 0x000055d6da2edd8c Fortran::frontend::FrontendAction::execute()
#8 0x000055d6da2e0efe Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&)
#9 0x000055d6da2f110e Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*)
#10 0x000055d6d9251f21 fc1_main(llvm::ArrayRef<char const*>, char const*)
#11 0x000055d6d924ff66 main
#12 0x00007f65cd52ed90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#13 0x00007f65cd52ee40 call_init ./csu/../csu/libc-start.c:128:20
#14 0x00007f65cd52ee40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#15 0x000055d6d924f995 _start
flang-new: error: unable to execute command: Segmentation fault
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 16.0.4 (https://github.com/llvm/llvm-project ae42196bc493ffe877a7e3dff8be32035dea4d07)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
The above is the result with LLVM16.0.4, but the crash still occurred even when using the recently built flang-new.
Gfortran
```console
$ gfortran -c test.f
test.f:6:72:
3 | common /foo/n
| 2
......
6 | call foo(a(1))
| 1
Error: Global name ‘foo’ at (1) is already being used as a COMMON at (2)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycV1tv2zoS_jX0y8ACRd0f_OCT1N0A7Z6DtthXgxJHMrc0aZBUEv_7BSnFtxppukIu1HD0zTfU3MSdk4NGXJHiL1I8Lvjod8aufi65tebFLVojjqsHy90OBbRH8DuE3ihlXqQewKPzcLBmsHwPhNU77w-OZGvCNoRtBul3Y5t0Zk_YRqnnt3_L8NjSjdIjYZtWmZawzZ5LTdhmY6y3PKyG_rS0OFh0TpooryrCNmnTNLShxTJNepAu8jJWDlJzRVhD6COha1LS6acz2hmFs5Tl0HEfySf9JIN4ubG1ZvRSI7xeyi1yBZywWp-gp43O7PdGA2Gb3hjCNvp6U3upR7yUofb2CEfCan4LxZWCiBK26jRsX2ugFjduzbfx7ydrjYU9OscHDK_gnRPAoEuyNSjTEVYTxhLCNvN5MEaydUmydcoCgWwNFgX2UksvjQbTgzvuW6NA8z0KIKzqjdkSVt1gfzEvaGOQGPjy5T9f4ekb9FwqFB8lkQUSxUyi41obDy2Gc31G61FcIAeNvXQu2CMlDdIflmuneCD9KLnCzj9pj7bnHZKSgsVBOm_jPvTGgpiU4tocAmAvbTIo03L1zrl_97z7CWLcH35z6EBYRoG-UkppUYhScNbRqqwhZka2JtnaHd20-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