[llvm-bugs] [Bug 51920] New: SEGV in Clang

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 20 13:58:31 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51920

            Bug ID: 51920
           Summary: SEGV in Clang
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jhaberman at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Just encountered this crash.  Sorry I'm not able to take the time to reduce it
or try on different versions of Clang.


upb/def.c:1435:20: error: use of undeclared identifier 'f'
  bool is_proto2 = f->file->syntax == UPB_SYNTAX_PROTO2;
                   ^
upb/def.c:1436:7: error: use of undeclared identifier 'field'
  if (field->descriptortype == UPB_DTYPE_STRING && is_proto2) {
      ^
upb/def.c:1439:5: error: use of undeclared identifier 'field'
    field->descriptortype = UPB_DTYPE_BYTES;
    ^
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -U_FORTIFY_SOURCE -fstack-protector
-Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer
-g -MD -MF bazel-out/k8-dbg/bin/_objs/reflection/def.pic.d
-frandom-seed=bazel-out/k8-dbg/bin/_objs/reflection/def.pic.o -fPIC -iquote .
-iquote bazel-out/k8-dbg/bin -iquote external/com_google_protobuf -iquote
bazel-out/k8-dbg/bin/external/com_google_protobuf -std=c99 -pedantic
-Werror=pedantic -Wall -Wstrict-prototypes -no-canonical-prefixes
-Wno-builtin-macro-redefined -D__DATE__="redacted" -D__TIMESTAMP__="redacted"
-D__TIME__="redacted" -c upb/def.c -o
bazel-out/k8-dbg/bin/_objs/reflection/def.pic.o 
1.      <unknown> parser at unknown location
2.      upb/def.c:2508:60: parsing function body 'build_filedef'
3.      upb/def.c:2508:60: in compound statement ('{}')
4.      upb/def.c:2579:27: in compound statement ('{}')
 #0 0x00007f6cf831cf8f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd0f8f)
 #1 0x00007f6cf831b2f0 llvm::sys::RunSignalHandlers()
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbcf2f0)
 #2 0x00007f6cf831c6dd llvm::sys::CleanupOnSignal(unsigned long)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd06dd)
 #3 0x00007f6cf8260dc0 (/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb14dc0)
 #4 0x00007f6cff4f5140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #5 0x00007f6cfd1c3432 clang::Lexer::LexTokenInternal(clang::Token&, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x979432)
 #6 0x00007f6cfd21c0e4 clang::Preprocessor::Lex(clang::Token&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9d20e4)
 #7 0x00007f6cfd22ea43 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9e4a43)
 #8 0x00007f6cfd229373 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9df373)
 #9 0x00007f6cfd259ae6
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa0fae6)
#10 0x00007f6cfd25ab7a
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa10b7a)
#11 0x00007f6cfd2575b9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa0d5b9)
#12 0x00007f6cfd2574f9
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa0d4f9)
#13 0x00007f6cfd2a58d5
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa5b8d5)
#14 0x00007f6cfd2a430f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa5a30f)
#15 0x00007f6cfd2a3e0e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa59e0e)
#16 0x00007f6cfd2aac20 clang::Parser::ParseCompoundStatementBody(bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa60c20)
#17 0x00007f6cfd2a43aa
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa5a3aa)
#18 0x00007f6cfd2a3e0e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa59e0e)
#19 0x00007f6cfd2a8d0a clang::Parser::ParseForStatement(clang::SourceLocation*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa5ed0a)
#20 0x00007f6cfd2a44fa
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa5a4fa)
#21 0x00007f6cfd2a3e0e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa59e0e)
#22 0x00007f6cfd2aac20 clang::Parser::ParseCompoundStatementBody(bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa60c20)
#23 0x00007f6cfd2ab9a5 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa619a5)
#24 0x00007f6cfd2c28a6
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa788a6)
#25 0x00007f6cfd2349b6 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9ea9b6)
#26 0x00007f6cfd2c1aad
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa77aad)
#27 0x00007f6cfd2c14bc
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa774bc)
#28 0x00007f6cfd2c0746
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa76746)
#29 0x00007f6cfd2bec9b
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0xa74c9b)
#30 0x00007f6cfd2216ed clang::ParseAST(clang::Sema&, bool, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9d76ed)
#31 0x00007f6cfe7ed0c8 clang::FrontendAction::Execute()
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1fa30c8)
#32 0x00007f6cfe7a3641
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1f59641)
#33 0x00007f6cfe853200
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x2009200)
#34 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang+0x4131bf)
#35 0x00000000004115fe (/usr/bin/clang+0x4115fe)
#36 0x00007f6cfe4d6732 (/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8c732)
#37 0x00007f6cf8260bcd
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb14bcd)
#38 0x00007f6cfe4d5c5f
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8bc5f)
#39 0x00007f6cfe4ada7f
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c63a7f)
#40 0x00007f6cfe4adc27
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c63c27)
#41 0x00007f6cfe4c178c
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c7778c)
#42 0x00000000004110a3 main (/usr/bin/clang+0x4110a3)
#43 0x00007f6cf7247d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#44 0x000000000040e89a _start (/usr/bin/clang+0x40e89a)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Debian clang version 11.0.1-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
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/def-9f75ad.c
clang: note: diagnostic msg: /tmp/def-9f75ad.sh
clang: note: diagnostic msg: 

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210920/f80f027d/attachment.html>


More information about the llvm-bugs mailing list