Skip to content

SourceColumnMap::byteToContainingColumn(int) const: Assertion `0 <= N && N < static_cast<int>(m_byteToColumn.size())' failed #32936

@llvmbot

Description

@llvmbot
Bugzilla Link 33589
Resolution FIXED
Resolved on Aug 08, 2017 17:03
Version trunk
OS Linux
Blocks #33196
Attachments preprocessed source, reproducer script
Reporter LLVM Bugzilla Contributor
CC @zmodem,@stbergmann

Extended Description

Trying to build raptor2 2.0.15 (http://download.librdf.org/source/raptor2-2.0.15.tar.gz) with a recent clang 5.0 snapshot (SVN rev 305643) results in

clang-5.0: ../tools/clang/lib/Frontend/TextDiagnostic.cpp:281: int (anonymous namespace)::SourceColumnMap::byteToContainingColumn(int) const: Assertion `0 <= N && N < static_cast(m_byteToColumn.size())' failed.
#​0 0x0000003e4a2d859f llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib64/libLLVMSupport.so.5.0+0x3e4a2d859f)
#​1 0x0000003e4a2d717e llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVMSupport.so.5.0+0x3e4a2d717e)
#​2 0x0000003e4a2d8803 (/usr/lib64/libLLVMSupport.so.5.0+0x3e4a2d8803)
#​3 0x0000003b2a60f830 __restore_rt (/lib64/libpthread.so.0+0x3b2a60f830)
#​4 0x0000003b29e2f0b6 __GI_raise (/lib64/libc.so.6+0x3b29e2f0b6)
#​5 0x0000003b29e2ffbb __GI_abort (/lib64/libc.so.6+0x3b29e2ffbb)
#​6 0x0000003b29e29732 __GI___assert_fail (/lib64/libc.so.6+0x3b29e29732)
#​7 0x0000003b29e29776 __GI___assert_perror_fail (/lib64/libc.so.6+0x3b29e29776)
#​8 0x0000003e560d7d06 std::__cxx11::basic_string<char, std::char_traits, std::allocator > std::operator+<char, std::char_traits, std::allocator >(char, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (/usr/lib64/libclangFrontend.so.5.0+0x3e560d7d06)
#​9 0x0000003e560d6b51 clang::TextDiagnostic::emitSnippetAndCaret(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::SmallVectorImplclang::CharSourceRange&, llvm::ArrayRefclang::FixItHint, clang::SourceManager const&) (/usr/lib64/libclangFrontend.so.5.0+0x3e560d6b51)
#​10 0x0000003e560a90b9 clang::DiagnosticRenderer::emitCaret(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::ArrayRefclang::CharSourceRange, llvm::ArrayRefclang::FixItHint, clang::SourceManager const&) (/usr/lib64/libclangFrontend.so.5.0+0x3e560a90b9)
#​11 0x0000003e560a8d93 clang::DiagnosticRenderer::emitDiagnostic(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::StringRef, llvm::ArrayRefclang::CharSourceRange, llvm::ArrayRefclang::FixItHint, clang::SourceManager const*, llvm::PointerUnion<clang::Diagnostic const*, clang::StoredDiagnostic const*>) (/usr/lib64/libclangFrontend.so.5.0+0x3e560a8d93)
#​12 0x0000003e560aa26c clang::DiagnosticRenderer::emitSingleMacroExpansion(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::ArrayRefclang::CharSourceRange, clang::SourceManager const&) (/usr/lib64/libclangFrontend.so.5.0+0x3e560aa26c)
#​13 0x0000003e560a95e6 clang::DiagnosticRenderer::emitMacroExpansions(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::ArrayRefclang::CharSourceRange, llvm::ArrayRefclang::FixItHint, clang::SourceManager const&) (/usr/lib64/libclangFrontend.so.5.0+0x3e560a95e6)
#​14 0x0000003e560a8dd8 clang::DiagnosticRenderer::emitDiagnostic(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::StringRef, llvm::ArrayRefclang::CharSourceRange, llvm::ArrayRefclang::FixItHint, clang::SourceManager const*, llvm::PointerUnion<clang::Diagnostic const*, clang::StoredDiagnostic const*>) (/usr/lib64/libclangFrontend.so.5.0+0x3e560a8dd8)
#​15 0x0000003e560d9ca5 clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/usr/lib64/libclangFrontend.so.5.0+0x3e560d9ca5)
#​16 0x0000003e541211dc clang::DiagnosticIDs::EmitDiag(clang::DiagnosticsEngine&, clang::DiagnosticIDs::Level) const (/usr/lib64/libclangBasic.so.5.0+0x3e541211dc)
#​17 0x0000003e5412110c clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/usr/lib64/libclangBasic.so.5.0+0x3e5412110c)
#​18 0x0000003e5411c916 clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/usr/lib64/libclangBasic.so.5.0+0x3e5411c916)
#​19 0x0000003e5387321a (/usr/lib64/libclangLex.so.5.0+0x3e5387321a)
#​20 0x0000003e5386f26f clang::Preprocessor::HandlePragmaDirective(clang::SourceLocation, clang::PragmaIntroducerKind) (/usr/lib64/libclangLex.so.5.0+0x3e5386f26f)
#​21 0x0000003e5386f741 clang::Preprocessor::Handle_Pragma(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5386f741)
#​22 0x0000003e53864ff4 clang::Preprocessor::ExpandBuiltinMacro(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e53864ff4)
#​23 0x0000003e53864842 clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&, clang::MacroDefinition const&) (/usr/lib64/libclangLex.so.5.0+0x3e53864842)
#​24 0x0000003e5387a6a1 clang::Preprocessor::HandleIdentifier(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5387a6a1)
#​25 0x0000003e5387ac68 clang::Preprocessor::Lex(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5387ac68)
#​26 0x0000003e5386f74c clang::Preprocessor::Handle_Pragma(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5386f74c)
#​27 0x0000003e53864ff4 clang::Preprocessor::ExpandBuiltinMacro(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e53864ff4)
#​28 0x0000003e53864842 clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&, clang::MacroDefinition const&) (/usr/lib64/libclangLex.so.5.0+0x3e53864842)
#​29 0x0000003e5387a6a1 clang::Preprocessor::HandleIdentifier(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5387a6a1)
#​30 0x0000003e5387ac68 clang::Preprocessor::Lex(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5387ac68)
#​31 0x0000003e5386f74c clang::Preprocessor::Handle_Pragma(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5386f74c)
#​32 0x0000003e53864ff4 clang::Preprocessor::ExpandBuiltinMacro(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e53864ff4)
#​33 0x0000003e53864842 clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&, clang::MacroDefinition const&) (/usr/lib64/libclangLex.so.5.0+0x3e53864842)
#​34 0x0000003e5387a6a1 clang::Preprocessor::HandleIdentifier(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5387a6a1)
#​35 0x0000003e5387ac68 clang::Preprocessor::Lex(clang::Token&) (/usr/lib64/libclangLex.so.5.0+0x3e5387ac68)
#​36 0x0000003e5782ebf9 (/usr/lib64/libclangParse.so.5.0+0x3e5782ebf9)
#​37 0x0000003e578a8dc9 clang::Parser::ExpectAndConsumeSemi(unsigned int) (/usr/lib64/libclangParse.so.5.0+0x3e578a8dc9)
#​38 0x0000003e57896c85 clang::Parser::ParseExprStatement() (/usr/lib64/libclangParse.so.5.0+0x3e57896c85)
#​39 0x0000003e57896275 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/lib64/libclangParse.so.5.0+0x3e57896275)
#​40 0x0000003e57895ec6 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) (/usr/lib64/libclangParse.so.5.0+0x3e57895ec6)
#​41 0x0000003e5789afaf clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib64/libclangParse.so.5.0+0x3e5789afaf)
#​42 0x0000003e5789b83b clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/lib64/libclangParse.so.5.0+0x3e5789b83b)
#​43 0x0000003e578acd62 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/lib64/libclangParse.so.5.0+0x3e578acd62)
#​44 0x0000003e5783dec1 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/lib64/libclangParse.so.5.0+0x3e5783dec1)
#​45 0x0000003e578ac3bb clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/lib64/libclangParse.so.5.0+0x3e578ac3bb)
#​46 0x0000003e578abf07 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/lib64/libclangParse.so.5.0+0x3e578abf07)
#​47 0x0000003e578ab52c clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/lib64/libclangParse.so.5.0+0x3e578ab52c)
#​48 0x0000003e578aa933 clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) (/usr/lib64/libclangParse.so.5.0+0x3e578aa933)
#​49 0x0000003e5782df92 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib64/libclangParse.so.5.0+0x3e5782df92)
#​50 0x0000003e560aedf7 clang::FrontendAction::Execute() (/usr/lib64/libclangFrontend.so.5.0+0x3e560aedf7)
#​51 0x0000003e5607b85a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib64/libclangFrontend.so.5.0+0x3e5607b85a)
#​52 0x0000003e5b406227 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclangFrontendTool.so.5.0+0x3e5b406227)
#​53 0x000000000041115f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-5.0+0x41115f)
#​54 0x000000000040f20a main (/usr/bin/clang-5.0+0x40f20a)
#​55 0x0000003b29e20ff3 __libc_start_main (/lib64/libc.so.6+0x3b29e20ff3)
#​56 0x000000000040cfba _start (/usr/bin/clang-5.0+0x40cfba)
Stack dump:
0. Program arguments: /usr/bin/clang-5.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -flto -flto-unit -disable-free -main-file-name turtle_parser.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/bero/abf/raptor2/BUILD/raptor2-2.0.15/src/.libs/turtle_parser.gcno -resource-dir /usr/lib64/clang/5.0.0 -D HAVE_CONFIG_H -I . -D LIBRDFA_IN_RAPTOR -I ../librdfa -D RAPTOR_INTERNAL=1 -I /usr/include/libxml2 -I /usr/include/libxml2 -D _FORTIFY_SOURCE=2 -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/5.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Os -Wstrict-aliasing=2 -Wformat -Werror=format-security -fdebug-compilation-dir /home/bero/abf/raptor2/BUILD/raptor2-2.0.15/src -ferror-limit 19 -fmessage-length 277 -stack-protector 1 -stack-protector-buffer-size 4 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o .libs/turtle_parser.o -x c turtle_parser.c

  1.  turtle_parser.c:1555:3 <Spelling=turtle_parser.c:333:64>: current parser token ')'
    
  2.  turtle_parser.c:1349:1: parsing function body 'turtle_parser_parse'
    
  3.  turtle_parser.c:1349:1: in compound statement ('{}')
    

clang-5.0: error: unable to execute command: Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions