Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on rc2 #229

Closed
wheatman opened this issue Jan 9, 2024 · 7 comments
Closed

crash on rc2 #229

wheatman opened this issue Jan 9, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@wheatman
Copy link
Contributor

wheatman commented Jan 9, 2024

Describe the bug

Was compiling random old cilk code to test rc2 and found this crash in the ligra code

Expected behavior

for the crash not to happen

OpenCilk version

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

The code does compile with version

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

back trace

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/opencilk16/build/bin/clang-16 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -clear-ast-before-backend -main-file-name encoder.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 -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/wheatman/ligra/apps -resource-dir /home/wheatman/opencilk16/build/lib/clang/16 -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/opencilk16/build/lib/clang/16/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 -fdebug-compilation-dir=/home/wheatman/ligra/apps -ferror-limit 19 -fopencilk --opencilk-abi-bitcode=/home/wheatman/opencilk16/build/lib/clang/16/lib/x86_64-unknown-linux-gnu/libopencilk-abi.bc -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -stripmine-loops -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/encoder-16152e.o -x c++ encoder.C
1.      ./utils.h:487:5: current parser token 'return'
2.      ./utils.h:423:1: parsing namespace 'pbbs'
3.      ./utils.h:470:58: parsing function body 'pbbs::new_array_no_init'
4.      ./utils.h:470:58: in compound statement ('{}')
 #0 0x000055ed0819a547 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/wheatman/opencilk16/build/bin/clang-16+0x25ca547)
 #1 0x000055ed081983fe llvm::sys::RunSignalHandlers() (/home/wheatman/opencilk16/build/bin/clang-16+0x25c83fe)
 #2 0x000055ed0819ad3a SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fd63a09f520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000055ed0a8f2947 clang::Sema::HandleSimpleCilkForStmt(clang::SourceLocation, clang::SourceLocation, clang::Stmt*, clang::Expr*, clang::Expr*, clang::SourceLocation, clang::Stmt*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4d22947)
 #5 0x000055ed0a8f3736 clang::Sema::ActOnCilkForStmt(clang::SourceLocation, clang::SourceLocation, clang::Stmt*, clang::DeclStmt*, clang::Sema::ConditionResult, clang::DeclStmt*, clang::DeclStmt*, clang::Sema::ConditionResult, clang::Sema::FullExprArg, clang::SourceLocation, clang::Stmt*, clang::DeclStmt*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4d23736)
 #6 0x000055ed0a224feb clang::Parser::ParseCilkForStatement(clang::SourceLocation*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4654feb)
 #7 0x000055ed0a20593d clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/home/wheatman/opencilk16/build/bin/clang-16+0x463593d)
 #8 0x000055ed0a204977 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4634977)
 #9 0x000055ed0a208a40 clang::Parser::ParseIfStatement(clang::SourceLocation*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4638a40)
#10 0x000055ed0a205746 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/home/wheatman/opencilk16/build/bin/clang-16+0x4635746)
#11 0x000055ed0a204977 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4634977)
#12 0x000055ed0a20e950 clang::Parser::ParseCompoundStatementBody(bool) (/home/wheatman/opencilk16/build/bin/clang-16+0x463e950)
#13 0x000055ed0a20f9c5 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/home/wheatman/opencilk16/build/bin/clang-16+0x463f9c5)
#14 0x000055ed0a146877 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4576877)
#15 0x000055ed0a218f52 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/wheatman/opencilk16/build/bin/clang-16+0x4648f52)
#16 0x000055ed0a2173c7 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/wheatman/opencilk16/build/bin/clang-16+0x46473c7)
#17 0x000055ed0a216ca5 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/wheatman/opencilk16/build/bin/clang-16+0x4646ca5)
#18 0x000055ed0a160721 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/home/wheatman/opencilk16/build/bin/clang-16+0x4590721)
#19 0x000055ed0a1438e0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/wheatman/opencilk16/build/bin/clang-16+0x45738e0)
#20 0x000055ed0a17fe08 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/home/wheatman/opencilk16/build/bin/clang-16+0x45afe08)
#21 0x000055ed0a17f5c8 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/home/wheatman/opencilk16/build/bin/clang-16+0x45af5c8)
#22 0x000055ed0a1607c6 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/home/wheatman/opencilk16/build/bin/clang-16+0x45907c6)
#23 0x000055ed0a1438e0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/wheatman/opencilk16/build/bin/clang-16+0x45738e0)
#24 0x000055ed0a141a9f clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/wheatman/opencilk16/build/bin/clang-16+0x4571a9f)
#25 0x000055ed0a13c3be clang::ParseAST(clang::Sema&, bool, bool) (/home/wheatman/opencilk16/build/bin/clang-16+0x456c3be)
#26 0x000055ed08ce19b0 clang::FrontendAction::Execute() (/home/wheatman/opencilk16/build/bin/clang-16+0x31119b0)
#27 0x000055ed08c52a9f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/wheatman/opencilk16/build/bin/clang-16+0x3082a9f)
#28 0x000055ed08db5e63 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/wheatman/opencilk16/build/bin/clang-16+0x31e5e63)
#29 0x000055ed06b6f367 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/wheatman/opencilk16/build/bin/clang-16+0xf9f367)
#30 0x000055ed06b6ba6b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#31 0x000055ed06b6b426 clang_main(int, char**) (/home/wheatman/opencilk16/build/bin/clang-16+0xf9b426)
#32 0x00007fd63a086d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#33 0x00007fd63a086e40 call_init ./csu/../csu/libc-start.c:128:20
#34 0x00007fd63a086e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#35 0x000055ed06b67bf5 _start (/home/wheatman/opencilk16/build/bin/clang-16+0xf97bf5)
clang-16: error: unable to execute command: Segmentation fault
clang-16: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 16.0.6 (https://github.com/OpenCilk/opencilk-project aee817f154a3c6b0dbb45a386f31591c0c62a5f6)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk16/build/bin
clang-16: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-16: note: diagnostic msg: /tmp/encoder-320d36.cpp
clang-16: note: diagnostic msg: /tmp/encoder-320d36.sh
clang-16: note: diagnostic msg: 

********************

requested files
encoder-320d36.sh.txt
encoder-320d36.cpp.txt

@wheatman wheatman added the bug Something isn't working label Jan 9, 2024
@VoxSciurorum
Copy link
Contributor

The file encoder-320d36.cpp.txt is empty. Is it too large to attach to a bug report?

@wheatman
Copy link
Contributor Author

wheatman commented Jan 9, 2024

trying again to upload the file
encoder-320d36.cpp.txt

@VoxSciurorum
Copy link
Contributor

The file uploaded and I have reproduced the crash.

@VoxSciurorum
Copy link
Contributor

Reduced test case:

void test(char *data, unsigned long size)
{
  _Cilk_for (unsigned long i = 0; i < size; i = i + (1 << 21))
    ((char*) data)[i] = 0;
}

@VoxSciurorum
Copy link
Contributor

Even more reduced test case:

void test()
{
  _Cilk_for (int i = 0; i < 1; i = i + 1)
    ;
}

The compiler is crashing because it wants i += 1 instead of i = i + 1.

@neboat
Copy link
Collaborator

neboat commented Jan 9, 2024

Looks like I accidentally removed a check for complicated stride calculations during some refactoring of cilk_for processing. Sorry about that.

I made a PR that seems to fix the issue.

@neboat
Copy link
Collaborator

neboat commented Jan 13, 2024

A fix for this crash is included in the latest release.

@neboat neboat closed this as completed Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants