Skip to content

Crash with Release 2 with reducers with bad types  #124

@wheatman

Description

@wheatman

Describe the bug

If I try and make a reducer, but don't define the functions that I pass in the compiler crashes instead of just telling me I used functions that don't exist.

del.cpp:10:20: error: cannot compile this scalar expression yet
int cilk_reducer(zero, plus) sum1 = 0;
^~~~
Unexpected placeholder builtin type!
UNREACHABLE executed at /home/wheatman/opencilk/opencilk/clang/lib/CodeGen/CodeGenTypes.cpp:645!

Expected behavior

For it to not crash and point out that I used a type that doesn't exist.

OpenCilk version

clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project fc90ded)
Target: x86_64-unknown-linux-gnu
Thread model: posix

System information

Ubuntu 18.04.6 LTS on WSL

Steps to reproduce (include relevant output)

build the following code with the command /clang++ -fopencilk -std=c++20 del.cpp

#include <cilk/cilk.h>

int main() {
  int cilk_reducer(zero, plus) sum1 = 0;
  return 0;
}

Additional comments

If I fix the bug and define the functions in the reducer properly
The crash no longer happens

backtrace:
del.cpp:4:20: error: cannot compile this scalar expression yet
int cilk_reducer(zero, plus) sum1 = 0;
^~~~
Unexpected placeholder builtin type!
UNREACHABLE executed at /home/wheatman/opencilk/opencilk/clang/lib/CodeGen/CodeGenTypes.cpp:645!
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/opencilk/build/bin/clang-14 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name del.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/wheatman/crash_testing -resource-dir /home/wheatman/opencilk/build/lib/clang/14.0.6 -c-isystem /usr/include/openmpi/ -c-isystem /home/wheatman/local/include/ -c-isystem /usr/include/openmpi/ -c-isystem /home/wheatman/local/include/ -c-isystem . -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/opencilk/build/lib/clang/14.0.6/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 -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=/home/wheatman/crash_testing -ferror-limit 19 -fopencilk --opencilk-abi-bitcode=/home/wheatman/opencilk/build/lib/clang/14.0.6/lib/x86_64-unknown-linux-gnu/libopencilk-abi.bc -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/del-88f44d.o -x c++ del.cpp

  1.  <eof> parser at end of file
    
  2.  del.cpp:3:5: LLVM IR generation of declaration 'main'
    
  3.  del.cpp:3:5: Generating code for declaration 'main'
    

#0 0x000000000200c4f3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/wheatman/opencilk/build/bin/clang-14+0x200c4f3)
#1 0x000000000200a21e llvm::sys::RunSignalHandlers() (/home/wheatman/opencilk/build/bin/clang-14+0x200a21e)
#2 0x000000000200c9bf SignalHandler(int) Signals.cpp:0:0
#3 0x00007f7701f9d980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007f77009c2e87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f77009c47f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
#6 0x0000000001f8bf91 (/home/wheatman/opencilk/build/bin/clang-14+0x1f8bf91)
#7 0x00000000024adb74 (/home/wheatman/opencilk/build/bin/clang-14+0x24adb74)
#8 0x00000000026cee9c clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#9 0x00000000026c42f8 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/home/wheatman/opencilk/build/bin/clang-14+0x26c42f8)
#10 0x0000000002680317 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/home/wheatman/opencilk/build/bin/clang-14+0x2680317)
#11 0x00000000026661c2 clang::CodeGen::CodeGenFunction::EmitReducerInit(clang::VarDecl const*, clang::CodeGen::CodeGenFunction::ReducerCallbacks const&, llvm::Value*) (/home/wheatman/opencilk/build/bin/clang-14+0x26661c2)
#12 0x0000000002663828 clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/home/wheatman/opencilk/build/bin/clang-14+0x2663828)
#13 0x000000000265e399 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (/home/wheatman/opencilk/build/bin/clang-14+0x265e399)
#14 0x000000000265dee8 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/home/wheatman/opencilk/build/bin/clang-14+0x265dee8)
#15 0x00000000023d07bc clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/home/wheatman/opencilk/build/bin/clang-14+0x23d07bc)
#16 0x00000000023c5800 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home/wheatman/opencilk/build/bin/clang-14+0x23c5800)
#17 0x00000000023c4f2b clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home/wheatman/opencilk/build/bin/clang-14+0x23c4f2b)
#18 0x00000000023d16d0 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/home/wheatman/opencilk/build/bin/clang-14+0x23d16d0)
#19 0x00000000024343b3 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/home/wheatman/opencilk/build/bin/clang-14+0x24343b3)
#20 0x00000000024350f0 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/home/wheatman/opencilk/build/bin/clang-14+0x24350f0)
#21 0x0000000002457b75 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/wheatman/opencilk/build/bin/clang-14+0x2457b75)
#22 0x000000000244fd2d clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/wheatman/opencilk/build/bin/clang-14+0x244fd2d)
#23 0x000000000245c1ba clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/home/wheatman/opencilk/build/bin/clang-14+0x245c1ba)
#24 0x000000000308f800 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#25 0x000000000308c0d6 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/home/wheatman/opencilk/build/bin/clang-14+0x308c0d6)
#26 0x0000000003b8f538 clang::ParseAST(clang::Sema&, bool, bool) (/home/wheatman/opencilk/build/bin/clang-14+0x3b8f538)
#27 0x0000000002a268e0 clang::FrontendAction::Execute() (/home/wheatman/opencilk/build/bin/clang-14+0x2a268e0)
#28 0x00000000029a294f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/wheatman/opencilk/build/bin/clang-14+0x29a294f)
#29 0x0000000002ade723 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/wheatman/opencilk/build/bin/clang-14+0x2ade723)
#30 0x00000000009ea687 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/wheatman/opencilk/build/bin/clang-14+0x9ea687)
#31 0x00000000009e8350 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#32 0x00000000009e80e4 main (/home/wheatman/opencilk/build/bin/clang-14+0x9e80e4)
#33 0x00007f77009a5c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#34 0x00000000009e521a _start (/home/wheatman/opencilk/build/bin/clang-14+0x9e521a)
clang-14: error: unable to execute command: Aborted
clang-14: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project fc90ded)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/crash_testing/../opencilk/build/bin
clang-14: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-14: note: diagnostic msg: /tmp/del-47b98a.cpp
clang-14: note: diagnostic msg: /tmp/del-47b98a.sh
clang-14: note: diagnostic msg:


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions