llvm / llvm/llvm-project

[mlir] -test-func-insert-result bug report

Open
#205,285 1 comment 0 reactions 0 assignees View on GitHub
crash mlir
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

git version: 5492d06d4fb99795b3b7247be374cdcb47f5ac03

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt -test-func-insert-result a.mlir`

a.mlir:

```mlir
module {
llvm.func @f(%arg0: f32 {test.erase_this}) attributes {test.insert_results = [[1, f32, {test.A}]]} {
llvm.return
}
llvm.func @_mlir_ciface_f(f32 {test.erase_this}) attributes {test.insert_results = [[1, f32, {test.A}]]}
}

```

stack trace:

```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -test-func-insert-result 59.mlir
#0 0x00005556b0e8d0f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20300f8)
#1 0x00005556b0e89f91 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x202cf91)
#2 0x00005556b0e8e216 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f61ece41420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00005556b9b76bb5 mlir::TypeRange::dereference_iterator(llvm::PointerUnion const*, llvm::Repeated const*>, long) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad19bb5)
#5 0x00005556b9b7813b mlir::insertTypesInto(mlir::TypeRange, llvm::ArrayRef, mlir::TypeRange, llvm::SmallVectorImpl&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad1b13b)
#6 0x00005556b16511e1 mlir::FunctionOpInterface::getTypeWithArgsAndResults(llvm::ArrayRef, mlir::TypeRange, llvm::ArrayRef, mlir::TypeRange) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x27f41e1)
#7 0x00005556b16519cf (anonymous namespace)::TestFuncInsertResult::runOnOperation() TestFunc.cpp:0:0
#8 0x00005556b9838502 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9db502)
#9 0x00005556b9839344 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+0xa9dc344)
#10 0x00005556b984025a mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9e325a)
#11 0x00005556b983fb8f mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9e2b8f)
#12 0x00005556b0f3c3d0 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#13 0x00005556b0f3b606 llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#14 0x00005556b9b8c8a5 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad2f8a5)
#15 0x00005556b0f32666 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20d5666)
#16 0x00005556b0f32a45 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20d5a45)
#17 0x00005556b0f32da5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20d5da5)
#18 0x00005556b0e72b82 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x2015b82)
#19 0x00007f61ec45f083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#20 0x00005556b0e726be _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20156be)
Segmentation fault (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Run mlir-opt -test-func-insert-result a.mlir with the supplied reproducer, then inspect TestFunc.cpp and FunctionOpInterface::getTypeWithArgsAndResults(), the frames named in the stack trace. Trace the result-type insertion for the two llvm.func operations and confirm the reproducer no longer segfaults; add regression coverage if the project’s nearby tests provide a suitable location.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.