<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62722>62722</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Segmentation fault error in --mlir-to-llvmir
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dvlp-r
</td>
</tr>
</table>
<pre>
hi, I encountered a bug while trying to go from .mlir to .ll.
The command I was using is the following
```
mlir-translate -opaque-pointers=0 \
--mlir-to-llvmir \
output/04baseline.mlir \
-o output/05baseline.ll
```
The error I encounter due to a segmentation fault is the following
```
ElementsAttr does not provide iteration facilities for type `mlir::Attribute`, see attribute: dense_resource<__elided__> : tensor<16x7xf32>
invalid `T` for ElementsAttr::getValues
UNREACHABLE executed at /working_dir/llvm-project/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h:307!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: mlir-translate -opaque-pointers=0 --mlir-to-llvmir output/04baseline.mlir -o output/05baseline.ll
#0 0x00000000006a7647 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm-project/bin/mlir-translate+0x6a7647)
#1 0x00000000006a558e llvm::sys::RunSignalHandlers() (/opt/llvm-project/bin/mlir-translate+0x6a
558e)
#2 0x00000000006a7f7f SignalHandler(int) Signals.cpp:0:0
#3 0x00007fb92dc49420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fb92d6dc00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fb92d6bb859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x000000000065ce51 (/opt/llvm-project/bin/mlir-translate+0x65ce51)
#7 0x000000000079aa3c (/opt/llvm-project/bin/mlir-translate+0x79aa3c)
#8 0x000000000079a1f1 std::enable_if<std::is_same<mlir::Attribute, mlir::Attribute>::value || !std::is_base_of<mlir::Attribute, mlir::Attribute>::value, mlir::detail::ElementsAttrRange<mlir::detail::ElementsAttrIterator<mlir::Attribute>>>::type mlir::ElementsAttr::getValues<mlir::Attribute>() const TensorOps.cpp:0:0
#9 0x0000000000a24680 mlir::LLVM::detail::getLLVMConstant(llvm::Type*, mlir::Attribute, mlir::Location, mlir::LLVM::ModuleTranslation const&) (/opt/llvm-project/bin/mlir-translate+0xa24680)
#10 0x0000000000a27a50 mlir::LLVM::ModuleTranslation::convertGlobals() (/opt/llvm-project/bin/mlir-translate+0xa27a50)
#11 0x0000000000a2b973 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef) (/opt/llvm-project/bin/mlir-translate+0xa2b973)
#12 0x0000000000a1b3c6 std::_Function_handler<mlir::LogicalResult (mlir::Operation*, llvm::raw_ostream&), mlir::registerToLLVMIRTranslation()::$_0>::_M_invoke(std::_Any_data const&, mlir::Operation*&&, llvm::raw_ostream&) ConvertToLLVMIR.cpp:0:0
#13 0x0000000000d5b5b8 std::_Function_handler<mlir::LogicalResult (std::shared_ptr<llvm::SourceMgr> const&, llvm::raw_ostream&, mlir::MLIRContext*), mlir::TranslateFromMLIRRegistration::TranslateFromMLIRRegistration(llvm::StringRef, llvm::StringRef, std::function<mlir::LogicalResult (mlir::Operation*, llvm::raw_ostream&)> const&, std::function<void (mlir::DialectRegistry&)> const&)::$_2>::_M_invoke(std::_Any_data const&, std::shared_ptr<llvm::SourceMgr> const&, llvm::raw_ostream&, mlir::MLIRContext*&&) Translation.cpp:0:0
#14 0x0000000000d5a1a9 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::mlirTranslateMain(int, char**, llvm::StringRef)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirTranslateMain.cpp:0:0
#15 0x0000000000d61de8 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) (/opt/llvm-project/bin/mlir-translate+0xd61de8)
#16 0x0000000000d58c73 mlir::mlirTranslateMain(int, char**, llvm::StringRef) (/opt/llvm-project/bin/mlir-translate+0xd58c73)
#17 0x000000000065b815 main (/opt/llvm-project/bin/mlir-translate+0x65b815)
#18 0x00007fb92d6bd083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#19 0x000000000065b71e _start (/opt/llvm-project/bin/mlir-translate+0x65b71e)
```
Thank you in advance for your help.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWMtu4zoS_RpmQ9igqKcXXjhue26AZG4jydytQEklmROa1CUpJ_77ASXFlvzoDtyYaUzQD4cmq86pOlV8MGN4JQHmKLxH4bc71tiN0vNiJ-qJvstUsZ9vOKJL_IBB5qqRFjQUmOGsqfD7hgvAVu-5rLBVuFK41GqLp1vBtRuYCjFF5Bsii-7f1w3gXG23TBb4Ab8zgxvj1nKD7QZwqYRQ71xWwzUoIv2f9ldnemI1k0YwC3iiavZ3A5NacQfNIP8bwShcdpPxlZ_JpDOjJkLstlwPVqjG1o1FdE2CjBkQXEJH5-dG1WBxeFgsxEUex4CA1koP44uLBlz0GDZQbUFaZrmSuGSNsGehwj-I1UqAW24W1mpcKDBYKotrrXa8AMwt6E_LORfccjC4VBrbfQ0YRcTRRv4C-QtngGeNBWeaLrEBwOww5i9wAdJAqsGoRueA_GWaguAFFGmK_BV2UyxIozTyl170EX-UPkX-qoPJ5Y4JXjiXrygiLYYh9A5DBfYvJhow3aJ__fN5tVj-sbh_XGH4gLyxTpYWI7p-V_qNyyotuEZ07TI8qbX6N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