<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/85776>85776</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] fatal internal error: CHECK(p) failed at /root/llvm-project/flang/include/flang/Semantics/symbol.h(785)
        </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/feW6aGqd8

Reproducer:
```console
$ cat test.f90
real :: r
block
asynchronous :: r
parameter (r = 1.0)
end block
end
```

Stack dump:
```console
fatal internal error: CHECK(p) failed at /root/llvm-project/flang/include/flang/Semantics/symbol.h(785)
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-20240319/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 0x00000000036e9c58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x36e9c58)
 #1 0x00000000036e75cc SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fab68242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007fab682969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007fab68242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007fab682287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000004b51ba9 (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x4b51ba9)
 #7 0x0000000003fe2466 Fortran::semantics::DeclarationVisitor::Pre(Fortran::parser::NamedConstantDef const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x3fe2466)
 #8 0x0000000003fe2c70 void Fortran::parser::Walk<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>, Fortran::semantics::ResolveNamesVisitor>(Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>> const&, Fortran::semantics::ResolveNamesVisitor&) (.part.0) resolve-names.cpp:0:0
 #9 0x0000000003feac5b void Fortran::parser::Walk<Fortran::parser::DeclarationConstruct, Fortran::semantics::ResolveNamesVisitor>(std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct>> const&, Fortran::semantics::ResolveNamesVisitor&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x3feac5b)
#10 0x0000000003fe9a4d Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::SpecificationPart const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x3fe9a4d)
#11 0x0000000003fea239 std::enable_if<TupleTrait<Fortran::parser::SpecificationPart>, void>::type Fortran::parser::Walk<Fortran::parser::SpecificationPart, Fortran::semantics::ResolveNamesVisitor>(Fortran::parser::SpecificationPart const&, Fortran::semantics::ResolveNamesVisitor&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x3fea239)
#12 0x00000000040088f9 Fortran::semantics::ConstructVisitor::Pre(Fortran::parser::BlockConstruct const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x40088f9)
#13 0x0000000004008ba7 void Fortran::parser::Walk<Fortran::semantics::ResolveNamesVisitor>(std::__cxx11::list<Fortran::parser::ExecutionPartConstruct, std::allocator<Fortran::parser::ExecutionPartConstruct>> const&, Fortran::semantics::ResolveNamesVisitor&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x4008ba7)
#14 0x000000000400c012 Fortran::semantics::ResolveNamesVisitor::ResolveExecutionParts(Fortran::semantics::ProgramTree const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x400c012)
#15 0x0000000004010173 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x4010173)
#16 0x0000000004011754 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x4011754)
#17 0x0000000004069341 Fortran::semantics::Semantics::Perform() (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x4069341)
#18 0x000000000372dfb7 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x372dfb7)
#19 0x0000000003a57170 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x3a57170)
#20 0x000000000372d595 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x372d595)
#21 0x000000000371d367 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x371d367)
#22 0x000000000373381d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x373381d)
#23 0x0000000001ed6368 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x1ed6368)
#24 0x0000000001ddb6ad main (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x1ddb6ad)
#25 0x00007fab68229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x00007fab68229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x0000000001ed52ce _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240319/bin/flang-new+0x1ed52ce)
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 5373daad9492e157c0c1ad496334f5dfd78d7da0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWVtv2zzS_jXKDSFDos4XuXCTuG_xfVgUdXffS4MiRzY3FKklqdTZX78gJR-kpmmcrbtvkAQSDzPzzDMz4oEYw7cS4DbIPgTZ_Q3p7U7p28eQaK2-mZtasefbL9BpxXrKawFISfRRsVoJGyTLILoPouXO2s64N7wK8Go79C6U3gZ49e8Arxr4Mycf_8XKYfjw_yAU9FFOkEfDL1XSKAFjK04RJRZZMHbRVNHQqoEI5GYmS6SHploo-jg8EvMs6U4rqXozG9URTVqwoFGAS42C5B7FiyjA1dANkqEzQSDZzLZzDGtL6CNifdv9BENDLBGISwtaEoFAa-Vgo7s_Hu7-L8BlF-AKNYQLYIhYFOCVVsoGeCXEUxt2Wv0TqHttBJHOq1xS0TM4a1lDS6Tl1AR4ZZ7bWonFLsBlUWZHaJ___2G5fkCmr1tuEUF1v0UaOqUtsgrNSOR219cLqtrRiO9t4cb04NQhIhkaLUJ2B4hqYnaoJvTRakJh8UNnRYsgqj5rtdWkRURv-xakdUY4D6jOaaGq7bgAHcK-E0qDdm0Oc-jM8ehDq3v5GOIIp1ESVwFe1VweXBNK-IbChsYotJp3AtC-zDd5GvbyUapvMhRc9vtwK3sUrlHYahCKEsuVDFvFQKCOUxR2nIYCnkAgPLxwE3YcUGiJ3oINadc7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