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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation failed with "fatal internal error: Length type parameter not found in parameter order at /root/llvm-project/flang/lib/Semantics/runtime-type-info.cpp(49)"
        </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/o35s7e5oP

Reproducer
```console
 type base  (l1)
        integer, len  :: l1

        integer, allocatable :: arr(:)
      end type base

      type, extends(base) :: c1 (k1,l2)
        integer, kind :: k1
        integer, len  :: l2

        class(base(l1+l2)), pointer :: p
      end type c1

      type c2  (k2,l3,l4)
        integer, kind :: k2
 integer, len  :: l3, l4

        type(c1(l4,k2,l4)) :: t(l3)
 end type c2

      class(c2(1,:,:)), allocatable :: b(:)

end
```

Stack dump
```console
 #0 0x0000000003554a28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3554a28)
 #1 0x000000000355239c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f290bc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f290bc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f290bc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f290bc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00000000049ed8f9 (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x49ed8f9)
 #7 0x0000000003e6a0b5 Fortran::evaluate::StructureConstructor Fortran::semantics::RuntimeTableBuilder::GetValue<Fortran::evaluate::SomeKind<(Fortran::common::TypeCategory)0>>(std::optional<Fortran::evaluate::Expr<Fortran::evaluate::SomeKind<(Fortran::common::TypeCategory)0>>> 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-20240224/bin/flang-new+0x3e6a0b5)
 #8 0x0000000003e7420d 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-20240224/bin/flang-new+0x3e7420d)
 #9 0x0000000003e7118e Fortran::semantics::RuntimeTableBuilder::DescribeType(Fortran::semantics::Scope&) (.part.0) runtime-type-info.cpp:0:0
#10 0x0000000003e73f18 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-20240224/bin/flang-new+0x3e73f18)
#11 0x0000000003e7118e Fortran::semantics::RuntimeTableBuilder::DescribeType(Fortran::semantics::Scope&) (.part.0) runtime-type-info.cpp:0:0
#12 0x0000000003e726e5 Fortran::semantics::RuntimeTableBuilder::DescribeTypes(Fortran::semantics::Scope&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3e726e5)
#13 0x0000000003e7272f Fortran::semantics::RuntimeTableBuilder::DescribeTypes(Fortran::semantics::Scope&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3e7272f)
#14 0x0000000003e7272f Fortran::semantics::RuntimeTableBuilder::DescribeTypes(Fortran::semantics::Scope&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3e7272f)
#15 0x0000000003e727cb Fortran::semantics::BuildRuntimeDerivedTypeTables(Fortran::semantics::SemanticsContext&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3e727cb)
#16 0x0000000003598f1f Fortran::frontend::FrontendAction::generateRtTypeTables() (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3598f1f)
#17 0x00000000038b95f0 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x38b95f0)
#18 0x0000000003596e75 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3596e75)
#19 0x0000000003586c17 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x3586c17)
#20 0x000000000359d0dd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x359d0dd)
#21 0x0000000001d6bfc8 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x1d6bfc8)
#22 0x0000000001c7128d main (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x1c7128d)
#23 0x00007f290bc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x00007f290bc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x0000000001d6af0e _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240224/bin/flang-new+0x1d6af0e)
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 10c48a772742b7afe665a815b7eba2047f17dc4b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWV1v47oR_TX0C2FDor4f_OB11rcXLdCLJOirQVEjhw1NCiSVOP31BUk5thTXm3Thh9tu4PVK_DhzzsxQHorUGL6TAEuUfUPZ3Yz29knp5fOcaq1ezaxWzdvyHjqtmp7xWgBWEv-mmloJi5IViu5QtHqytjPujmwQ2exC70LpHSKbfyGyUUlmCsjUH2F4-D6Cgh5a8yh8mJJGCQit2L51gGtqAGNEShEjUg09wx-XFnagEVljARJjxyNZYRGfG7swmAqhGLXUaRrmUK0RKb2QkRGQzYnHR1jX5RDhYEE2BpHSjyPVEZfFjvtzjMhakGsCnrlsjpOe48_pJJd0MkHNiYh327dg2n3WuFMOTh9Buotq2QUXhg7ig_FMnKDEfaWfVjXQ_Y9yEt-SXhIV_Fyy2ClKEVkHAmmQdUSwrjc58TnJueCpo58YQaR08fHBXw8pEHx1IVHqSZqEb5DNJJXPex8sZc-46ffd1XxHJIlwdIiOf0mWpZSUWIiXfbBu3ky4-ENzaT3so6bMx_l9kKavW2WsBrpHJHcyuLTeS6R0K7KziGyY2ndcgJ7DoRNKu2hsmKByN3dArb-yupfPcxKRNCIkRWRTc4nIJnRKeEXkW3QYSJ6cjkgST1SQpGL4ge8kFX-hshHOWjmQCs1mwboOJavI_3sHIgNQ0ZIqqllKMhINMgSvEdkcynybp3PBZX-Y72QfOtjCqEXu6fkpI3LJGLPKq5bhzj5poM32mQvxNQN-_shAOiWdFjneGa_zq-TTIh9hZ2NsUhZtgmmttP0asp84Qs7PY5ZW0JTtjTJmAB9ZL0YZAzmN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