[LLVMbugs] [Bug 12004] New: clang-sa crash when accessing a CFType in a union

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 14 14:55:28 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12004

             Bug #: 12004
           Summary: clang-sa crash when accessing a CFType in a union
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: tjw at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8051
  --> http://llvm.org/bugs/attachment.cgi?id=8051
example

Accessing a CFType via a union seems to make clang-sa crash (r150514)


- (BOOL)test;
{
    return CFArrayGetValueAtIndex(_u.multiple, 0) == nil;
}



0  clang             0x00000001044e0692 _ZL15PrintStackTracePv + 34
1  clang             0x00000001044e0ba9 _ZL13SignalHandleri + 697
2  libsystem_c.dylib 0x00007fff8db0ccfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff62c2030c _sigtramp + 18446744072989259308
4  clang             0x00000001044e08d6 abort + 22
5  clang             0x00000001044e0895 __assert_rtn + 53
6  clang             0x00000001035e952d void
clang::ento::check::PreStmt<clang::CallExpr>::_checkStmt<(anonymous
namespace)::ObjCContainersChecker>(void*, clang::Stmt const*,
clang::ento::CheckerContext&) + 1373
7  clang             0x000000010362d655
clang::ento::CheckerManager::runCheckersForStmt(bool,
clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNodeSet const&, clang::Stmt
const*, clang::ento::ExprEngine&) + 1125
8  clang             0x00000001036555d6
clang::ento::ExprEngine::VisitCallExpr(clang::CallExpr const*,
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) + 374
9  clang             0x0000000103641756
clang::ento::ExprEngine::Visit(clang::Stmt const*, clang::ento::ExplodedNode*,
clang::ento::ExplodedNodeSet&) + 2486
10 clang             0x00000001036404a2
clang::ento::ExprEngine::ProcessStmt(clang::CFGStmt,
clang::ento::ExplodedNode*) + 2994
11 clang             0x000000010363f7aa
clang::ento::ExprEngine::processCFGElement(clang::CFGElement,
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) +
122
12 clang             0x0000000103636d34
clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock const*, unsigned int,
clang::ento::ExplodedNode*) + 148
13 clang             0x000000010363644a
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>) + 794
14 clang             0x000000010359b202
_ZL16ActionExprEngineRN12_GLOBAL__N_116AnalysisConsumerERN5clang4ento15AnalysisManagerEPNS2_4DeclEb
+ 914
15 clang             0x000000010359ac7d (anonymous
namespace)::AnalysisConsumer::HandleCode(clang::Decl*) + 621
16 clang             0x000000010359a70d (anonymous
namespace)::AnalysisConsumer::HandleDeclContext(clang::ASTContext&,
clang::DeclContext*) + 1501
17 clang             0x000000010359a0a9 (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&) + 377
18 clang             0x000000010328ebb6 clang::ParseAST(clang::Sema&, bool) +
406
19 clang             0x0000000103049658
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 952
20 clang             0x0000000103030ba2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3026
21 clang             0x0000000103027ea9 cc1_main(char const**, char const**,
char const*, void*) + 5481
22 clang             0x000000010302cfdf main + 687
23 clang             0x0000000103026934 start + 52
Stack dump:
0.    Program arguments:
/Users/bungi/Source/LLVM/llvm/Release+Asserts/bin/clang -cc1 -triple
x86_64-apple-macosx10.7.0 -analyze -disable-free -main-file-name OSStyle-trim.m
-analyzer-store=region -analyzer-opt-analyze-nested-blocks
-analyzer-eagerly-assume -analyzer-checker=core -analyzer-checker=unix
-analyzer-checker=osx -analyzer-checker=deadcode
-analyzer-checker=security.insecureAPI.UncheckedReturn
-analyzer-checker=security.insecureAPI.getpw
-analyzer-checker=security.insecureAPI.gets
-analyzer-checker=security.insecureAPI.mktemp
-analyzer-checker=security.insecureAPI.mkstemp
-analyzer-checker=security.insecureAPI.vfork -analyzer-output plist -w
-pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 127.2 -g -resource-dir
/Users/bungi/Source/LLVM/llvm/Release+Asserts/bin/../lib/clang/3.1 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-D DEBUG -D DEBUG_bungi -D OMNI_STYLE_PRO -D IBOutlet=__attribute__((iboutlet))
-D IBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))
-D IBAction=void)__attribute__((ibaction) -D NS_BUILD_32_LIKE_64 -D
OMNI_BUILDING_FRAMEWORK -D
OMNI_BUNDLE_IDENTIFIER=@"com.omnigroup.framework.OmniStyle" -I
/Users/bungi/Library/Developer/Xcode/DerivedData/OmniOutlinerPro-4.0-glvtzqozvplnnocyknfrkcgytaqr/Build/Products/Debug/include
-I
/Users/bungi/Library/Developer/Xcode/DerivedData/OmniOutlinerPro-4.0-glvtzqozvplnnocyknfrkcgytaqr/Build/Intermediates/OmniStyle.build/DerivedSources
-I
/Users/bungi/Library/Developer/Xcode/DerivedData/OmniOutlinerPro-4.0-glvtzqozvplnnocyknfrkcgytaqr/Build/Products/Debug
-I
/Users/bungi/Library/Developer/Xcode/DerivedData/OmniOutlinerPro-4.0-glvtzqozvplnnocyknfrkcgytaqr/Build/Intermediates/OmniStyle.build/Debug/OmniStyle.build/DerivedSources/x86_64
-I
/Users/bungi/Library/Developer/Xcode/DerivedData/OmniOutlinerPro-4.0-glvtzqozvplnnocyknfrkcgytaqr/Build/Intermediates/OmniStyle.build/Debug/OmniStyle.build/DerivedSources
-F/Users/bungi/Library/Developer/Xcode/DerivedData/OmniOutlinerPro-4.0-glvtzqozvplnnocyknfrkcgytaqr/Build/Products/Debug
-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Library/Frameworks
-I Basic -fmodule-cache-path
/var/folders/19/nkl2y3fs1r3_5pt69r8bhf6m0000gp/T/clang-module-cache -O0
-Wno-trigraphs -Werror -Wno-missing-field-initializers -Wmissing-prototypes
-Wreturn-type -Wno-implicit-atomic-properties -Wformat -Wmissing-braces
-Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter
-Wunused-variable -Wunused-value -Wno-uninitialized -Wunknown-pragmas
-Wno-shadow -Wno-four-char-constants -Wsign-compare -Wshorten-64-to-32
-Wpointer-sign -Wnewline-eof -Wno-selector -Wno-strict-selector-match
-Wno-undeclared-selector -Wno-deprecated-implementations -Wprotocol
-Wdeprecated-declarations -Wno-conversion -Wno-sign-conversion -Wall
-Wno-#warnings -Wno-trigraphs -Winit-self -std=gnu99 -fdebug-compilation-dir
/Users/bungi/Source/Omni/PROJ/OmniGroup/Frameworks/OmniStyle -ferror-limit 19
-fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed
-fobjc-exceptions -fexceptions -fpascal-strings -fdiagnostics-show-option
-fcolor-diagnostics -analyzer-checker osx.cocoa.experimental.SelfInit -o
OSStyle-trim.plist -x objective-c
/Users/bungi/Source/Omni/20120214-StyleDiamond/OmniGroup/Frameworks/OmniStyle/OSStyle-trim.m 
1.    <eof> parser at end of file
2.   
/Users/bungi/Source/Omni/20120214-StyleDiamond/OmniGroup/Frameworks/OmniStyle/OSStyle-trim.m:26:10:
Error evaluating statement
3.   
/Users/bungi/Source/Omni/20120214-StyleDiamond/OmniGroup/Frameworks/OmniStyle/OSStyle-trim.m:26:10:
Error evaluating statement
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/19/nkl2y3fs1r3_5pt69r8bhf6m0000gp/T/OSStyle-trim-cn98ZB.mi
clang: note: diagnostic msg:
/var/folders/19/nkl2y3fs1r3_5pt69r8bhf6m0000gp/T/OSStyle-trim-cn98ZB.sh

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list