llvm / llvm/llvm-project

[opt] -passes='openmp-opt' causes Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"'

Open
#191,973 0 comments 0 reactions 0 assignees View on GitHub
crash generated by fuzzer llvm::Attributor
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Reproducer: https://godbolt.org/z/89Gh54GTv

```
opt: /root/llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From*) [with To = llvm::GlobalVariable; From = llvm::Value]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.
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: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=openmp-opt
1. Running pass "openmp-opt" on module ""
#0 0x0000000005c4f168 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5c4f168)
#1 0x0000000005c4bf94 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5c4bf94)
#2 0x0000000005c4c10a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007d60e0242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007d60e02969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007d60e0242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007d60e02287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007d60e022871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007d60e0239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000003531592 KernelInfo::getKernelEnvironementFromKernelInitCB(llvm::CallBase*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3531592)
#10 0x000000000356ec73 (anonymous namespace)::AAExecutionDomainFunction::updateImpl(llvm::Attributor&) OpenMPOpt.cpp:0:0
#11 0x000000000331b806 llvm::AbstractAttribute::update(llvm::Attributor&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x331b806)
#12 0x000000000332f770 llvm::Attributor::updateAA(llvm::AbstractAttribute&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x332f770)
#13 0x000000000356bc5b llvm::AAExecutionDomain const* llvm::Attributor::getOrCreateAAFor(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x356bc5b)
#14 0x000000000356fc44 (anonymous namespace)::OpenMPOpt::registerAAsForFunction(llvm::Attributor&, llvm::Function const&) OpenMPOpt.cpp:0:0
#15 0x0000000003570c0f (anonymous namespace)::OpenMPOpt::runAttributor(bool) (.part.0) OpenMPOpt.cpp:0:0
#16 0x00000000035719a2 (anonymous namespace)::OpenMPOpt::run(bool) (.part.0) OpenMPOpt.cpp:0:0
#17 0x0000000003574758 llvm::OpenMPOptPass::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3574758)
#18 0x00000000031c627e llvm::detail::PassModel>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x31c627e)
#19 0x00000000059b2266 llvm::PassManager>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59b2266)
#20 0x000000000096f03a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef, llvm::ArrayRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96f03a)
#21 0x00000000009630df optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9630df)
#22 0x00007d60e0229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007d60e0229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x00000000009585c5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9585c5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

Generated by fuzzer.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.