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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] flang-new crashes when equivalence attribute conflicts with allocatable attribute
        </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/Tqr6eb3dz

Reproducer:
```console
$ cat test.f90
allocatable :: i(:), j(:)
equivalence(i, j)
end
```

Stack dump:
```console
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-20240518/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 -resource-dir /opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/.. -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #0 0x0000000003870558 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x3870558)
 #1 0x000000000386decc SignalHandler(int) Signals.cpp:0:0
 #2 0x00007575cce42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007575cce969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007575cce42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007575cce287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000001edd217 (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x1edd217)
 #7 0x00000000041daf3d Fortran::semantics::DeclarationVisitor::CheckEquivalenceSets() (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x41daf3d)
 #8 0x00000000041decbf Fortran::semantics::ResolveNamesVisitor::FinishSpecificationPart(std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct>> const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x41decbf)
 #9 0x00000000041eb9f8 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::SpecificationPart const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x41eb9f8)
#10 0x00000000041e9a89 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-20240518/bin/flang-new+0x41e9a89)
#11 0x0000000004210e64 Fortran::semantics::ResolveNamesVisitor::ResolveSpecificationParts(Fortran::semantics::ProgramTree&) (.part.0) resolve-names.cpp:0:0
#12 0x00000000042114f6 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x42114f6)
#13 0x0000000004212a04 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x4212a04)
#14 0x000000000426be51 Fortran::semantics::Semantics::Perform() (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x426be51)
#15 0x00000000038c2005 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x38c2005)
#16 0x0000000003bef85a Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x3bef85a)
#17 0x00000000038c1415 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x38c1415)
#18 0x00000000038b0d17 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x38b0d17)
#19 0x00000000038c745d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x38c745d)
#20 0x0000000002020c08 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x2020c08)
#21 0x0000000001f0ede4 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x1f0ede4)
#22 0x00007575cce29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007575cce29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x000000000201fb6e _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin/flang-new+0x201fb6e)
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 881f20e958e80bd30463fc57d2d3e891bcb8a571)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240518/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WU1v4zjS_jXyhZBAUR-WDj54knjeAV4sgnZ292hQVMnmhCI1JJU48-sXpOTYUrrT7UZ7giQ2v6qep6pIlkrUGL6XAKsg-y3I7he0twelV88h1Vq9mkWl6rfVF-i0qnvGKwFISfS7qislbJCsA3wf4PXB2s64Ft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