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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] fatal internal error: nullptr dereference at llvm-project/flang/lib/Semantics/runtime-type-info.cpp(795)
        </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/MPq6KEEvz

Reproducer:
```console
module m
  type t(k1)
     integer,kind :: k1
  end type
  type s(l1)
     integer,len :: l1
     type(t(3)) :: t1
  end type
end module
```

Stack dump:
```console
 #0 0x0000000003513fb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3513fb8)
 #1 0x000000000351192c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fc3fc042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007fc3fc0969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007fc3fc042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007fc3fc0287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000004992ea9 (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x4992ea9)
 #7 0x0000000003e199e9 Fortran::semantics::RuntimeTableBuilder::DescribeComponent(Fortran::semantics::Symbol const&, Fortran::semantics::ObjectEntityDetails const&, Fortran::semantics::Scope&, Fortran::semantics::Scope&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<Fortran::common::Reference<Fortran::semantics::Symbol const>, std::allocator<Fortran::common::Reference<Fortran::semantics::Symbol const>>> const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3e199e9)
 #8 0x0000000003e16b64 Fortran::semantics::RuntimeTableBuilder::DescribeType(Fortran::semantics::Scope&) (.part.0) runtime-type-info.cpp:0:0
 #9 0x0000000003e180e5 Fortran::semantics::RuntimeTableBuilder::DescribeTypes(Fortran::semantics::Scope&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3e180e5)
#10 0x0000000003e1812f Fortran::semantics::RuntimeTableBuilder::DescribeTypes(Fortran::semantics::Scope&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3e1812f)
#11 0x0000000003e1812f Fortran::semantics::RuntimeTableBuilder::DescribeTypes(Fortran::semantics::Scope&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3e1812f)
#12 0x0000000003e181cb Fortran::semantics::BuildRuntimeDerivedTypeTables(Fortran::semantics::SemanticsContext&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3e181cb)
#13 0x000000000355883f Fortran::frontend::FrontendAction::generateRtTypeTables() (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x355883f)
#14 0x000000000386d128 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x386d128)
#15 0x0000000003556795 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3556795)
#16 0x0000000003546667 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x3546667)
#17 0x000000000355c9fd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x355c9fd)
#18 0x0000000001d57758 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x1d57758)
#19 0x0000000001c5e82d main (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x1c5e82d)
#20 0x00007fc3fc029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#21 0x00007fc3fc029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#22 0x0000000001d566be _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin/flang-new+0x1d566be)
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 d0f44ed062d911953de157ee4d7db91003b9bd52)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240126/bin
flang-new: note: diagnostic msg:
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWF1z4yoS_TXyC2WXhL4f_OBJoru3trb2VjLvLgQthQ0CL6CMc3_9FkiOjWauJ6lZv-xOTRIJmtPndDcIIMbwXgJso_xLlN-vyGifld6-rInW6ptZtYq9bR_hoBUbKW8FICXRb4q1Stgo3aFnaw8mSncRbiLc9FPHRuk-ws2fEW7-8ce_i78_PLz-GcX3Ubybfp_wQLuRU0cRT_-pkkYJmFoHxUYBaJjeELJvB0A2wtVLEuH61IoQ4tJCDzrCdy9cMuRg0x16SU4mIJkfHACZCFfiL4EEyBOOSC4sPAyuHIvUjcX1ycz-hTv3NilZaL2MyZMl9AWxcTj8JCYowmmM4mN8-pfmSdq1FRLidZiYmDczPfyhubQe-asm1NE-G2nyba-M1UCGCBcRvnPavRpcRbhRBxvhhqrhwAXoNRwPQmkXmIYKIvu1A-r8k9WjfFnjGGdx4oCalssIN1OnhG8R_hIfZ5LnYEc4TRYqkhpT9MR7ScTfiGT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