<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86382>86382</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] fatal internal error: PutEntity: unexpected details: Entity
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Reproducible on Godbolt:
https://godbolt.org/z/5jnqcW5GM
Reproducer:
```console
$ cat test.f90
module m
contains
subroutine s(x)
type(*), intrinsic :: x
end subroutine
end module
```
Stack dump:
```console
fatal internal error: PutEntity: unexpected details: Entity
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
#0 0x0000000003730928 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x3730928)
#1 0x000000000372e29c SignalHandler(int) Signals.cpp:0:0
#2 0x00007f6250042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007f62500969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007f6250042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007f62500287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x0000000004ba4a49 (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x4ba4a49)
#7 0x000000000427f265 (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x427f265)
#8 0x0000000004284a2a Fortran::semantics::ModFileWriter::PutEntity(llvm::raw_ostream&, Fortran::semantics::Symbol const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x4284a2a)
#9 0x0000000004284add auto Fortran::semantics::ModFileWriter::PutSymbol(llvm::raw_ostream&, Fortran::semantics::Symbol const&)::'lambda10'(auto const&)::operator()<Fortran::semantics::EntityDetails>(auto const&) const (.isra.0) mod-file.cpp:0:0
#10 0x00000000042852cf Fortran::semantics::ModFileWriter::PutSymbol(llvm::raw_ostream&, Fortran::semantics::Symbol const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x42852cf)
#11 0x0000000004286432 Fortran::semantics::ModFileWriter::PutSubprogram(Fortran::semantics::Symbol const&) (.part.0) mod-file.cpp:0:0
#12 0x0000000004284eaa Fortran::semantics::ModFileWriter::PutSymbol(llvm::raw_ostream&, Fortran::semantics::Symbol const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x4284eaa)
#13 0x000000000428b0d2 Fortran::semantics::ModFileWriter::PutSymbols(Fortran::semantics::Scope const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x428b0d2)
#14 0x0000000004289ad1 Fortran::semantics::ModFileWriter::Write(Fortran::semantics::Symbol const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x4289ad1)
#15 0x000000000428b740 Fortran::semantics::ModFileWriter::WriteAll() (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x428b740)
#16 0x00000000040bde0f Fortran::semantics::Semantics::Perform() (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x40bde0f)
#17 0x0000000003774e77 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x3774e77)
#18 0x0000000003a9f670 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x3a9f670)
#19 0x0000000003774455 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x3774455)
#20 0x0000000003764207 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x3764207)
#21 0x000000000377a6dd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x377a6dd)
#22 0x0000000001f16e98 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x1f16e98)
#23 0x0000000001e1b6fd main (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x1e1b6fd)
#24 0x00007f6250029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x00007f6250029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x0000000001f15dfe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin/flang-new+0x1f15dfe)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 19.0.0git (https://github.com/llvm/llvm-project.git 20e0bacd0560382a31ad0d4ecc7472bd4a99c659)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240323/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWV1v5CgW_TXUC3IJ4--HeqhJunpH2pFak5HmMcJwXWGCwQu4u7K_fgV2dcXOTLqT7VrtREnKfN17zj2A4RZzTh41wA4VP6HidsNG_2Ds7jFh1povbtMa8bT7FQZrxMhlqwAbjT8a0RrlUbZH5BaR_YP3gwslekD0cJxat8Ye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