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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] -generate-runtime-verification crashes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          wwy6191
      </td>
    </tr>
</table>

<pre>
    git version: adf892d743d91afc1af7893f97c770db31c26916

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt  -generate-runtime-verification a.mlir`


a.mlir:  
``` 
func.func @memref_reinterpret_cast_incompatible_element_types(%in: memref<*xf32>) {
 %out = memref.reinterpret_cast %in to
           offset: [0], sizes: [10], strides: [1] : memref<*xf32> to memref<?xf32, strided<[?], offset:?>>
 return
}
``` 
stack trace:

``` 
/data/szy/MLIR/seed/seed0/tmp.CINnXqXWtd.mlir:2:10: remark: location of op
  %out = memref.reinterpret_cast %in to
         ^
LLVM ERROR: Failed to infer result type(s):
"memref.extract_strided_metadata"(...) {} : (memref<*xf32>) -> ( ??? )
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -generate-runtime-verification /data/szy/MLIR/seed/seed0/tmp.CINnXqXWtd.mlir
 #0 0x0000563a3d0bb048 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1188048)
 #1 0x0000563a3d0b8b5e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1185b5e)
 #2 0x0000563a3d0bb9dd SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f47c1ff2420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f47c162f00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f47c160e859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x0000563a3d0db017 llvm::report_fatal_error(llvm::Twine const&, bool) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11a8017)
 #7 0x0000563a3d0db04e (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11a804e)
 #8 0x0000563a430ac177 (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x7179177)
 #9 0x0000563a3e92a439 mlir::memref::ExtractStridedMetadataOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::Value) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x29f7439)
#10 0x0000563a3e9c0d58 mlir::memref::ExtractStridedMetadataOp mlir::OpBuilder::create<mlir::memref::ExtractStridedMetadataOp, mlir::detail::TypedValue<mlir::BaseMemRefType>&>(mlir::Location, mlir::detail::TypedValue<mlir::BaseMemRefType>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x2a8dd58)
#11 0x0000563a3e9c0ab6 mlir::memref::(anonymous namespace)::computeLinearBounds(mlir::OpBuilder&, mlir::Location, mlir::detail::TypedValue<mlir::BaseMemRefType>) RuntimeOpVerification.cpp:0:0
#12 0x0000563a3e9c075f mlir::detail::RuntimeVerifiableOpInterfaceInterfaceTraits::FallbackModel<mlir::memref::(anonymous namespace)::ReinterpretCastOpInterface>::generateRuntimeVerification(mlir::detail::RuntimeVerifiableOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::OpBuilder&, mlir::Location) RuntimeOpVerification.cpp:0:0
#13 0x0000563a4051cebc void llvm::function_ref<void (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::RuntimeVerifiableOpInterface, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<void, void>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::GenerateRuntimeVerificationPass::runOnOperation()::$_0, mlir::RuntimeVerifiableOpInterface, void>(mlir::Operation*, (anonymous namespace)::GenerateRuntimeVerificationPass::runOnOperation()::$_0&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) GenerateRuntimeVerification.cpp:0:0
#14 0x0000563a3d1d0ffe void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x129dffe)
#15 0x0000563a3d1d0ffe void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x129dffe)
#16 0x0000563a4051cd0a (anonymous namespace)::GenerateRuntimeVerificationPass::runOnOperation() GenerateRuntimeVerification.cpp:0:0
#17 0x0000563a404f77a6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c47a6)
#18 0x0000563a404f80d0 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c50d0)
#19 0x0000563a404fa6a2 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c76a2)
#20 0x0000563a404f2f4a performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x0000563a404f2b9d llvm::LogicalResult llvm::function_ref<llvm::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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#22 0x0000563a4059ed75 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x466bd75)
#23 0x0000563a404ecb85 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45b9b85)
#24 0x0000563a404ece2f mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45b9e2f)
#25 0x0000563a404ed15e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45ba15e)
#26 0x0000563a3d09bb37 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1168b37)
#27 0x00007f47c1610083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#28 0x0000563a3d09b6ae _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11686ae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