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

    <tr>
        <th>Summary</th>
        <td>
            [flang] flang-new crashes (gfortran/regression/typebound_operator_17.f90)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </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/typebound_operator_17.f90

Step to reproduce:
```shell
flang-new -flang-experimental-polymorphism -flang-experimental-hlfir typebound_operator_17.f90
```

Error messages before crash:
```console
error: loc("./typebound_operator_17.f90":40:5): 'fir.convert' op invalid type conversion
error: Lowering to LLVM IR failed
error: loc("./typebound_operator_17.f90":7:3): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func
error: failed to create the LLVM module
```

Stack dump:
```console
 #0 0x00005595b4b2c972 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
 #1 0x00005595b4b2cfc2 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007ff20242e520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00005595b4c79d96 Fortran::frontend::CodeGenAction::executeAction()
 #4 0x00005595b4b4dd0e Fortran::frontend::FrontendAction::execute()
 #5 0x00005595b4b45f07 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&)
 #6 0x00005595b4b504e6 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*)
 #7 0x00005595b3ba2984 fc1_main(llvm::ArrayRef<char const*>, char const*)
 #8 0x00005595b3ba0b32 main
 #9 0x00007ff202415d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#10 0x00007ff202415e40 call_init ./csu/../csu/libc-start.c:128:20
#11 0x00007ff202415e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#12 0x00005595b3b9ff95 _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 17.0.0 (https://github.com/llvm/llvm-project.git cc31d787c3f29f3afbbfee15e1dda846ec962d70)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVt9v4ygQ_mvIC4qF8e-HPHjbzd1Ke9Jpu7rXCMPY4RaDBbhN_vsTOEmTbNXu6qTWwWP45pth-AbmnBw0wAYVn1DxuGKz3xu7-bFm1poXt-qMOG4eLHN7ELg7Yr8H3BulzIvUA_bgPJ6sGSwbUdYi8ohIu_d-cuGNbhHdDtLv5y7hZkR0q9Tz-Wcd1q7dLD0guu2U6RDdjkxqRLdbY71lYTT0l6GFwYJz0oQXf5ygM7MWOzOBZd7YXVolfUMWCsvzycOEvcEWJmvEzOFCEZVk-XN7UGqx9YrpYa3hBa-XIRwmsHIE7ZlaT0YdR2OnvXTjmxP2qpcWf8Tr7Pea5mdrjcUjOMcGcLiD3ljAPOT8Z8LcaGcULFYIK1HWYmU4ojWiNHk3N5SirM0JytoC0SYsRLTqpU240c9gPaIVNhOW-pkpKWIwePkU037r86t5ARuLwOCvX__5C3_5hnsmFYj_Qa5CWZuduHGmtfG4O3PwIK58hRmjdC4wQCUJ1u-WaaeYl0Y_SqaA-y_ag-0ZB1QSbGGQztv4HffGYrFMimMzBcB-1jwJj7sQlriCd26BeYjHIBIZjZjP2_Hm7j55xn9gMY_TB5uJEc0IJgdCCCmKpujyjvKmojgemqxFWeuObhn8baX2Efm7DdHR-nWSZS8747wFNiJaIvqApfYhpRcv6b2XnlP8JAfN1J9MCwUW0XpZdDK7hE-BP4n_FyB6Aqr6nhKaUygowXGvt0qG83yoy12Zr5XU82E96Hn5wBNnkhLRT-SQ04KSG3LZDTleNaIp8VkQYoC9NdqDFsvbgxHwB-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