[LLVMbugs] [Bug 24201] New: Missing type variable crashes clang

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 21 12:43:28 PDT 2015


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

            Bug ID: 24201
           Summary: Missing type variable crashes clang
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: juan.d.ceasar at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14624
  --> https://llvm.org/bugs/attachment.cgi?id=14624&action=edit
source file to crash on OS X (requires OS X as it uses ASL)

So the issue is:

$ /usr/local/bin/clang -c zips-crash.c 
zips-crash.c:124:14: error: expected identifier or '('
  xpc_type_t = xpc_get_type(event);


The missing variable of type "xpc_type_t" is the reason for the crash.  If this
var is there, it all compiles fine, but without it, I get a crash, as it looks
like it just can't repair some ambiguity in the AST?  Here's the output and
stack trace

------------------------------

$ /usr/local/bin/clang -c zips-crash.c 
zips-crash.c:124:14: error: expected identifier or '('
  xpc_type_t = xpc_get_type(event);
             ^
zips-crash.c:126:26: error: use of undeclared identifier 'type'; did you mean
'pipe'?
  if ( XPC_TYPE_ERROR == type ) {
                         ^~~~
                         pipe
/usr/include/unistd.h:464:6: note: 'pipe' declared here
int      pipe(int [2]);
         ^
zips-crash.c:126:23: warning: comparison of distinct pointer types ('const
struct _xpc_type_s *' and 'int (*)(int *)') [-Wcompare-distinct-pointer-types]
  if ( XPC_TYPE_ERROR == type ) {
       ~~~~~~~~~~~~~~ ^  ~~~~
zips-crash.c:140:15: error: use of undeclared identifier 'type'; did you mean
'pipe'?
  } else if ( type == XPC_TYPE_DICTIONARY ) {
              ^~~~
              pipe
/usr/include/unistd.h:464:6: note: 'pipe' declared here
int      pipe(int [2]);
         ^
zips-crash.c:140:20: warning: comparison of distinct pointer types ('int
(*)(int *)' and 'const struct _xpc_type_s *')
[-Wcompare-distinct-pointer-types]
  } else if ( type == XPC_TYPE_DICTIONARY ) {
              ~~~~ ^  ~~~~~~~~~~~~~~~~~~~
0  clang-3.8                0x00000001038b64bd
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 61
1  clang-3.8                0x00000001038b6f0b SignalHandler(int) + 603
2  libsystem_platform.dylib 0x00007fff93b27f1a _sigtramp + 26
3  clang-3.8                0x000000010436c7b6
clang::Sema::EmitCurrentDiagnostic(unsigned int) + 1366
4  clang-3.8                0x0000000104ac3130
clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const + 288
5  clang-3.8                0x0000000104952d40
clang::ASTContext::getTypeInfoImpl(clang::Type const*) const + 1440
6  clang-3.8                0x000000010495266e
clang::ASTContext::getTypeInfo(clang::Type const*) const + 174
7  clang-3.8                0x0000000104952b6d
clang::ASTContext::getTypeInfoImpl(clang::Type const*) const + 973
8  clang-3.8                0x000000010495266e
clang::ASTContext::getTypeInfo(clang::Type const*) const + 174
9  clang-3.8                0x000000010495254c
clang::ASTContext::getTypeInfoInChars(clang::Type const*) const + 140
10 clang-3.8                0x0000000104a762e5 (anonymous
namespace)::IntExprEvaluator::VisitBinaryOperator(clang::BinaryOperator const*)
+ 8549
11 clang-3.8                0x0000000104a71c2f
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) + 111
12 clang-3.8                0x0000000104a589ed Evaluate(clang::APValue&,
(anonymous namespace)::EvalInfo&, clang::Expr const*) + 429
13 clang-3.8                0x0000000104a55030 EvaluateAsRValue((anonymous
namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) + 96
14 clang-3.8                0x0000000104a56cf2
clang::Expr::EvaluateForOverflow(clang::ASTContext const&) const + 386
15 clang-3.8                0x000000010457bcf1
clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool,
bool, bool) + 369
16 clang-3.8                0x00000001041b28b6
clang::Parser::ParseIfStatement(clang::SourceLocation*) + 230
17 clang-3.8                0x00000001041b07bf
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2511
18 clang-3.8                0x00000001041afd8b
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 155
19 clang-3.8                0x00000001041b2ccf
clang::Parser::ParseIfStatement(clang::SourceLocation*) + 1279
20 clang-3.8                0x00000001041b07bf
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2511
21 clang-3.8                0x00000001041afd8b
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 155
22 clang-3.8                0x00000001041b68e3
clang::Parser::ParseCompoundStatementBody(bool) + 1507
23 clang-3.8                0x00000001041b71e4
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 180
24 clang-3.8                0x00000001041caa10
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
2240
25 clang-3.8                0x0000000104154231
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2673
26 clang-3.8                0x00000001041c9f7b
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 715
27 clang-3.8                0x00000001041c99e0
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 352
28 clang-3.8                0x00000001041c8e39
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2985
29 clang-3.8                0x00000001041c81d0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 432
30 clang-3.8                0x0000000104143846 clang::ParseAST(clang::Sema&,
bool, bool) + 390
31 clang-3.8                0x0000000103c993fe clang::FrontendAction::Execute()
+ 62
32 clang-3.8                0x0000000103c64fd2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 754
33 clang-3.8                0x0000000103cd3dda
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3658
34 clang-3.8                0x0000000102a3d5e7 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 1463
35 clang-3.8                0x0000000102a3c6bb main + 11691
36 libdyld.dylib            0x00007fff942a45c9 start + 1
37 libdyld.dylib            0x0000000000000030 start + 1809169000
Stack dump:
0.    Program arguments: /usr/local/bin/clang-3.8 -cc1 -triple
x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name zips-crash.c -mrelocation-model pic
-pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 251.4
-dwarf-column-info -coverage-file
/Users/jcarlson/Repositories/libFuzzer/xpc/fetch/zips-crash.c -resource-dir
/usr/local/bin/../lib/clang/3.8.0 -fdebug-compilation-dir
/Users/jcarlson/Repositories/libFuzzer/xpc/fetch -ferror-limit 19
-fmessage-length 204 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature
-fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o
zips-crash.o -x c zips-crash.c 
1.    zips-crash.c:140:45: current parser token '{'
2.    zips-crash.c:121:1: parsing function body 'zip_peer_event_handler'
3.    zips-crash.c:121:1: in compound statement ('{}')
clang-3.8: error: unable to execute command: Segmentation fault: 11
clang-3.8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (http://llvm.org/git/clang.git
9fdf093bc9a22a498bbb7ed95ff8099ed6350e00) (http://llvm.org/git/llvm.git
c1a9c38190740709ac5d6e514bd1bcff56f53bfb)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
clang-3.8: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.8: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.8: note: diagnostic msg:
/var/folders/q2/r9xyyzc153sfbrsrdzntl5fh0000gn/T/zips-crash-5dc065.c
clang-3.8: note: diagnostic msg:
/var/folders/q2/r9xyyzc153sfbrsrdzntl5fh0000gn/T/zips-crash-5dc065.sh
clang-3.8: 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/20150721/eb0893e3/attachment.html>


More information about the llvm-bugs mailing list