<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65034>65034</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][OpenMP] Crash observed in threadprivatised common block
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
NimishMishra
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
NimishMishra
</td>
</tr>
</table>
<pre>
If a common block symbol is not used in a threadprivatised directive, a LLVM symbol error is thrown.
```
program sample
integer:: x
integer :: y
common /blk/ x
!$omp threadprivate (/blk/)
!$omp parallel sections copyin(/blk/)
!$omp section
y = y + 1
!$omp end parallel sections
end program sample
```
Reproducer command: `flang-new -fc1 -fopenmp -emit-fir <file_name>.f90 -o -`
```
LLVM ERROR: symbol not mapped
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: flang-new -fc1 -fopenmp -emit-fir sample.f90 -o -
#0 0x0000555557cccf20 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nimish/community/llvm-project/install/bin/flang-new+0x2778f20)
#1 0x0000555557cca584 SignalHandler(int) Signals.cpp:0:0
#2 0x00007ffff7a37520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007ffff7a8ba7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#4 0x00007ffff7a8ba7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#5 0x00007ffff7a8ba7c pthread_kill ./nptl/pthread_kill.c:89:10
#6 0x00007ffff7a37476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#7 0x00007ffff7a1d7f3 abort ./stdlib/abort.c:81:7
#8 0x000055555645d004 llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
#9 0x0000555557c2371e (/home/nimish/community/llvm-project/install/bin/flang-new+0x26cf71e)
#10 0x0000555558041e6b (/home/nimish/community/llvm-project/install/bin/flang-new+0x2aede6b)
#11 0x0000555558095041 (anonymous namespace)::FirConverter::copyHostAssociateVar(Fortran::semantics::Symbol const&, mlir::OpBuilder::InsertPoint*) Bridge.cpp:0:0
#12 0x0000555558399523 std::_Function_handler<void (Fortran::parser::OmpClause::Copyin const*, Fortran::parser::CharBlock const&), ClauseProcessor::processCopyin() const::'lambda0'(Fortran::parser::OmpClause::Copyin const*, Fortran::parser::CharBlock const&)>::_M_invoke(std::_Any_data const&, Fortran::parser::OmpClause::Copyin const*&&, Fortran::parser::CharBlock const&) OpenMP.cpp:0:0
#13 0x000055555839fa29 ClauseProcessor::processCopyin() const (/home/nimish/community/llvm-project/install/bin/flang-new+0x2e4ba29)
#14 0x00005555583ae4fb genParallelOp(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Evaluation&, mlir::Location, Fortran::parser::OmpClauseList const&, bool) OpenMP.cpp:0:0
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8V1tv66wS_TXkBSXC-P6QhzRttCu1p1V7tF-jsY0TTjEgwGnz74_ATnNp9uXb2vqq1rW5LGbWmhkArOUbydgcpTeI0v_wjtvtI7dbA4hSlN5OoHdbZeanPZNKNfv5fYsB16rrlMSVUPUbtvuuUgJzi6VyuLeswVxiwG5rGDTa8B047lsbbljt-I4husSAHx6-Px4mM2OU8RBua9S7nCFyi8hifGZk_A2fGGujNgY6bKHTgh1auXRswwyKFyhe4I-LZjy278f20QNEV5V4Q3R1nIBohGiiOn3mAMOIFp-jES2_DtdgQAgmsPVeKmlxrfSeyx9MPJ06zjh2YbzHKL71T3qDo6-LMdl8XXAcFvqucHRB5PB8Ydqopq-ZCZyAbDxNKCOtALmZSvaOp20d4WmrNJOdxlPWcTdtuad02XLB1hI6huK7WVsSPFV4erHCxbJB9ruXl6cXv9Cov4-cDrRmzTDo-eFu8XqHbV913GHAVb_BhmllHHYKb53T1gvqCV1tuNv21axWHaIrIXaHf1Nt1P9Y7RBdcWt7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