Skip to content

Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. #324

@wheatman

Description

@wheatman

Describe the bug

Code triggers an assert

Expected behavior

expect for it to compile as it did for an old version

OpenCilk version

broken versions
clang version 19.1.7 (https://github.com/OpenCilk/opencilk-project cd64ec3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk3.0rc1/build/bin
Build config: +assertions

clang version 16.0.6 (https://github.com/OpenCilk/opencilk-project df80b7d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk16/build/bin/.

working version
clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project f54e987)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk201/build/bin/.

System information

PRETTY_NAME="Ubuntu 22.04.5 LTS"
on WSL

full backtrace

clang-19: /home/wheatman/opencilk3.0rc1/opencilk/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = llvm::DetachInst, From = llvm::Instruction]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/OpenCilk/opencilk-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/wheatman/opencilk3.0rc1/build/bin/clang-19 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir KCore- -disable-free -clear-ast-before-backend -main-file-name KCore.C -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/wheatman/ligra/apps -fcoverage-compilation-dir=/home/wheatman/ligra/apps -resource-dir /home/wheatman/opencilk3.0rc1/build/lib/clang/19 -D CILK -D BYTERLE -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward -internal-isystem /home/wheatman/opencilk3.0rc1/build/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=c++14 -fdeprecated-macro -ferror-limit 19 -fopencilk --opencilk-abi-bitcode=/home/wheatman/opencilk3.0rc1/build/lib/clang/19/lib/x86_64-unknown-linux-gnu/libopencilk-abi.bc -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -stripmine-loops -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/KCore-cf3e7f.o -x c++ KCore.C

  1.  <eof> parser at end of file
    
  2.  Optimizer
    
  3.  Running pass "require<globals-aa>,function(invalidate<aa>),require<profile-summary>,cgscc(devirt<4>(inline,function-attrs<skip-non-recursive-function-attrs>,argpromotion,openmp-opt-cgscc,function<eager-inv;no-rerun>(sroa<modify-cfg>,early-cse<memssa>,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>),function-attrs,function(require<should-not-run-function-passes>),coro-split)),function(invalidate<should-not-run-function-passes>),cgscc(devirt<4>())" on module "KCore.C"
    
  4.  Running pass "cgscc(devirt<4>(inline,function-attrs<skip-non-recursive-function-attrs>,argpromotion,openmp-opt-cgscc,function<eager-inv;no-rerun>(sroa<modify-cfg>,early-cse<memssa>,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,task-simplify,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>),function-attrs,function(require<should-not-run-function-passes>),coro-split))" on module "KCore.C"
    

#0 0x000055fd508abdc8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2481dc8)
#1 0x000055fd508a98ee llvm::sys::RunSignalHandlers() (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x247f8ee)
#2 0x000055fd508ac5a8 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f72bf338520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f72bf38c9fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007f72bf38c9fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007f72bf38c9fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007f72bf338476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007f72bf31e7f3 abort ./stdlib/abort.c:81:7
#9 0x00007f72bf31e71b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007f72bf32fe96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x000055fd509c223e HandleInlinedResumeInTask(llvm::BasicBlock*, llvm::BasicBlock*, llvm::ResumeInst*, llvm::BasicBlock*) InlineFunction.cpp:0:0
#12 0x000055fd509b9c21 llvm::InlineFunction(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, llvm::Function*) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x258fc21)
#13 0x000055fd51dacab8 llvm::InlinerPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x3982ab8)
#14 0x000055fd51b8f78d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::InlinerPass, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x376578d)
#15 0x000055fd547fa38f llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x63d038f)
#16 0x000055fd51b8381d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x375981d)
#17 0x000055fd547fd348 llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x63d3348)
#18 0x000055fd51b9ca8d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::DevirtSCCRepeatedPass, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x3772a8d)
#19 0x000055fd547fbf4c llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManagerllvm::Module&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x63d1f4c)
#20 0x000055fd51b83aad llvm::detail::PassModel<llvm::Module, llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::AnalysisManagerllvm::Module>::run(llvm::Module&, llvm::AnalysisManagerllvm::Module&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x3759aad)
#21 0x000055fd5043ed5a llvm::PassManager<llvm::Module, llvm::AnalysisManagerllvm::Module>::run(llvm::Module&, llvm::AnalysisManagerllvm::Module&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2014d5a)
#22 0x000055fd51daf2ef llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManagerllvm::Module&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x39852ef)
#23 0x000055fd51b895fd llvm::detail::PassModel<llvm::Module, llvm::ModuleInlinerWrapperPass, llvm::AnalysisManagerllvm::Module>::run(llvm::Module&, llvm::AnalysisManagerllvm::Module&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x375f5fd)
#24 0x000055fd5043ed5a llvm::PassManager<llvm::Module, llvm::AnalysisManagerllvm::Module>::run(llvm::Module&, llvm::AnalysisManagerllvm::Module&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2014d5a)
#25 0x000055fd50b5c350 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream>&, std::unique_ptr<llvm::ToolOutputFile, std::default_deletellvm::ToolOutputFile>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#26 0x000055fd50b51da1 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtrllvm::vfs::FileSystem, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream>, clang::BackendConsumer*) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2727da1)
#27 0x000055fd51107210 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2cdd210)
#28 0x000055fd52dc8d79 clang::ParseAST(clang::Sema&, bool, bool) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x499ed79)
#29 0x000055fd513c0aff clang::FrontendAction::Execute() (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2f96aff)
#30 0x000055fd5132b1ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x2f011ad)
#31 0x000055fd514a1c87 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0x3077c87)
#32 0x000055fd4f368072 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0xf3e072)
#33 0x000055fd4f3648be ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#34 0x000055fd4f3636e9 clang_main(int, char**, llvm::ToolContext const&) (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0xf396e9)
#35 0x000055fd4f374427 main (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0xf4a427)
#36 0x00007f72bf31fd90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#37 0x00007f72bf31fe40 call_init ./csu/../csu/libc-start.c:128:20
#38 0x00007f72bf31fe40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#39 0x000055fd4f3622a5 _start (/home/wheatman/opencilk3.0rc1/build/bin/clang-19+0xf382a5)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.1.7 (https://github.com/OpenCilk/opencilk-project cd64ec3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk3.0rc1/build/bin
Build config: +assertions
clang++: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/KCore-64a01f.cpp
clang++: note: diagnostic msg: /tmp/KCore-64a01f.sh
clang++: note: diagnostic msg:


make: *** [Makefile:51: KCore] Error 1

KCore-64a01f.sh.txt
KCore-64a01f.cpp.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions