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

    <tr>
        <th>Summary</th>
        <td>
            [flang] [OpenMP] Assertion `Outputs.empty() && "OpenMP outlining should not produce live-out values!"' failed.
        </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>
    Reproducer:
https://github.com/gcc-mirror/gcc/blob/master/libgomp/testsuite/libgomp.fortran/target8.f90

Stack dump:
```console
 #0 0x000055d7c2d38533 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
 #1 0x000055d7c2d38bae SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fb9958dc520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007fb995930a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #4 0x00007fb995930a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #5 0x00007fb995930a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #6 0x00007fb9958dc476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #7 0x00007fb9958c27f3 abort ./stdlib/abort.c:81:7
 #8 0x00007fb9958c271b _nl_load_domain ./intl/loadmsgcat.c:1177:9
 #9 0x00007fb9958d3e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x000055d7c4ee29a1 
#11 0x000055d7c3b607ab (anonymous namespace)::OpenMPDialectLLVMIRTranslationInterface::convertOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) const OpenMPToLLVMIRTranslation.cpp:0:0
#12 0x000055d7c42e5d66 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&) 
#13 0x000055d7c42e6056 mlir::LLVM::ModuleTranslation::convertBlock(mlir::Block&, bool, llvm::IRBuilderBase&) 
#14 0x000055d7c42e73b5 mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) 
#15 0x000055d7c42e8634 mlir::LLVM::ModuleTranslation::convertFunctions() 
#16 0x000055d7c42e9a06 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef) 
#17 0x000055d7c2e8b07c Fortran::frontend::CodeGenAction::generateLLVMIR() 
#18 0x000055d7c2e8c4a4 Fortran::frontend::CodeGenAction::executeAction() 
#19 0x000055d7c2d5ae34 Fortran::frontend::FrontendAction::execute() 
#20 0x000055d7c2d5229d Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) 
#21 0x000055d7c2d5dc94 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) 
#22 0x000055d7c1d35188 fc1_main(llvm::ArrayRef<char const*>, char const*) 
#23 0x000055d7c1d34176 main 
#24 0x00007fb9958c3d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#25 0x00007fb9958c3e40 call_init ./csu/../csu/libc-start.c:128:20
#26 0x00007fb9958c3e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#27 0x000055d7c1d336d5 _start 
flang-new: error: unable to execute command: Aborted
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git d230bf3fce6d7fb1d0a1c5ec10b3d2101adb11d6)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```

When I tested this program in August, I got the following TODO message:
```txt
not yet implemented: OMPD_target_data for Array Expressions or Structure Components
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycV11v5CoS_TXkBcWywZ8P_dCZ3N6NdEcZzUS7jy0MZTcbDBbgpPPvV-BOuu1EuZOR8mFjOOdQVFFVzDnZa4ANKm5QcXvFJn8wdvN4zaw1z-6qNeJl8xNGa8TEwSK6RektSr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