<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/73381>73381</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] --arith-emulate-wide-int causes Segmentation Fault
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anonymousMCS
</td>
</tr>
</table>
<pre>
git version: 024718313b526a4530d7cd58886fcc157247e0ff
system: Ubuntu 20.04.6 LTS (Focal Fossa)
reproduced with: ```mlir-opt --arith-emulate-wide-int a.mlir```
a.mlir:
```
func.func @func2() {
%cst_0 = arith.constant dense<0> : vector<2xi64>
%cst_4 = arith.constant dense<true> : vector<2xi1>
%2 = vector.mask %cst_4 { vector.multi_reduction <xor>, %cst_0, %cst_0 [] : vector<2xi64> to vector<2xi64> } : vector<2xi1> -> vector<2xi64>
return
}
```
trace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --arith-emulate-wide-int a.mlir
#0 0x000055a638a1d06f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x160306f)
#1 0x000055a638a1a0c4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f74c40f4420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x000055a63904b2f3 _ZSt9__find_ifIN4mlir17ValueTypeIteratorIN4llvm6detail27indexed_accessor_range_baseINS0_12OperandRangeEPNS0_9OpOperandENS0_5ValueES8_S8_E8iteratorEEEN9__gnu_cxx5__ops12_Iter_negateIZNKS0_13TypeConverter7isLegalINS0_14ValueTypeRangeIS5_EEEENSt9enable_ifIXaantsrSt14is_convertibleIT_NS0_4TypeEE5valuentsrSK_ISL_PNS0_9OperationEE5valueEbE4typeEOSL_EUlSM_E_EEESL_SL_SL_T0_St26random_access_iterator_tag (/data/bin/llvm-project/build/bin/mlir-opt+0x1c312f3)
#4 0x000055a63b6b31f5 mlir::TypeConverter::isLegal(mlir::Operation*) const (/data/bin/llvm-project/build/bin/mlir-opt+0x42991f5)
#5 0x000055a638d17793 std::_Function_handler<std::optional<bool> (mlir::Operation*), (anonymous namespace)::EmulateWideIntPass::runOnOperation()::'lambda0'(mlir::Operation*)>::_M_invoke(std::_Any_data const&, mlir::Operation*&&) EmulateWideInt.cpp:0:0
#6 0x000055a63b6a4eef mlir::ConversionTarget::isLegal(mlir::Operation*) const (/data/bin/llvm-project/build/bin/mlir-opt+0x428aeef)
#7 0x000055a63b6b967d (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#8 0x000055a63b6ba4e7 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) DialectConversion.cpp:0:0
#9 0x000055a63b6bc954 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) (/data/bin/llvm-project/build/bin/mlir-opt+0x42a2954)
#10 0x000055a638d2e2a3 (anonymous namespace)::EmulateWideIntPass::runOnOperation() EmulateWideInt.cpp:0:0
#11 0x000055a63b61211e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x41f811e)
#12 0x000055a63b6125fa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41f85fa)
#13 0x000055a63b612e24 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41f8e24)
#14 0x000055a63b603b93 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#15 0x000055a63b605064 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#16 0x000055a63b605214 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#17 0x000055a63b704504 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x42ea504)
#18 0x000055a63b5fda77 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x41e3a77)
#19 0x000055a63b605361 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x41eb361)
#20 0x000055a63b6057c6 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x41eb7c6)
#21 0x000055a6389545db main (/data/bin/llvm-project/build/bin/mlir-opt+0x153a5db)
#22 0x00007f74c3bc0083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#23 0x000055a6389ed3ce _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15d33ce)
Segmentation fault (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWVtT4zgW_jXmRUVKlnx94CEdklpqoJsizO7WvKhk-dho25G8kkzD_Pot2c7FgTBM0zM7u13phNhH53zfueko5tbKWgFcBPGnIL4845170OaCK62eN7qzN4v1WaHL54taOvQIxkqtAjpHmERpmNGQFjFJeBRTXKaijLMsSyohwjglUQq4qgJ8GeD58G6frYONX_1z0SnXIYJnOJol6Pp-jQKSrbTgDVppa3lA8sOVBlqjy05Aib5J9-BVBAkeXptGmnPdOnR-zo10D-ew6Rru4PybLOFcKof4zMvsFhwqHm_R8euRTNUpMfNvKIiw_yQByQKSoyD9NEggFJBYWMcwCugl6gHMhFbWceVQCcpCQBc4oEvkQT-CcNoEdEGeZBIFdHmkJXpLizMdvKYonOohvY5BYLbh9uuB8vTT7kbXOMkMlJ1wUisU0MWTV7gMyGLH6fBvNCTI6zSQ069cDNKX4h4sOvdvp3xhwHVGjfFIL18NzPDuDBdwKna318v5eolsV2ykQxwVXY0MtNo4D_bBudb6pWQVkFUt3UNXzITeBGTVNI_bj_PW6H-BcAFZSWs7sAFZIa5KJJVouhKQewAkDLcPqODia49nNphfOy6-orLbtDuAeIb6f7dG14ZvEDd1twHlbJ_OZFVyxwOyKqR6ab7oZFPubr475QePBoRihJ8wxjiOeUIzHpY4qVDPlM4D6itz-OPWSOV67Pe9c0m2FzL8G9PWGeCbgCQ-N6RyfTX4ovgO-A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