[LLVMbugs] [Bug 12993] New: Crash with case statement building block referencing self under ARC

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 30 19:01:48 PDT 2012


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

             Bug #: 12993
           Summary: Crash with case statement building block referencing
                    self under ARC
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tjw at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


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

This construct causes the compiler to crash:

    switch (row) {
        case 0:
        cell.handler = ^(id value) {
            self.value = value;
        };
        break;
        default:
        break;
    }

Adding an extra {...} scope around the contents of the case statement avoids
the problem.

See the attached file for a full example.

clang version 3.2 (trunk 157728)
Target: x86_64-apple-darwin11.4.0
Thread model: posix


/Volumes/Space/Users/bungi/Source/LLVM/llvm/Release+Asserts/bin/clang
-fobjc-arc -c block-referencing-self-in-case.m



Instruction does not dominate all uses!
  %8 = getelementptr inbounds <{ i8*, i32, i32, i8*,
%struct.__block_descriptor*, %1* }>* %block, i32 0, i32 5
  %strongdestroy = load %1** %8
Broken module found, compilation aborted!
0  clang             0x0000000108653f02 _ZL15PrintStackTracePv + 34
1  clang             0x0000000108654419 _ZL13SignalHandleri + 697
2  libsystem_c.dylib 0x00007fff842a3cfa _sigtramp + 26
3  libsystem_c.dylib 0x0000000000000004 _sigtramp + 18446603338298802980
4  clang             0x0000000108654146 abort + 22
5  clang             0x000000010860f5ca (anonymous
namespace)::Verifier::abortIfBroken() + 266
6  clang             0x000000010860e65e (anonymous
namespace)::Verifier::runOnFunction(llvm::Function&) + 1726
7  clang             0x00000001085f9d84
llvm::FPPassManager::runOnFunction(llvm::Function&) + 324
8  clang             0x00000001085f95cb
llvm::FunctionPassManagerImpl::run(llvm::Function&) + 235
9  clang             0x00000001085f94b5
llvm::FunctionPassManager::run(llvm::Function&) + 117
10 clang             0x00000001072a417b
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 4827
11 clang             0x00000001073837f2
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 594
12 clang             0x00000001073b7ef6 clang::ParseAST(clang::Sema&, bool,
bool) + 390
13 clang             0x00000001073828e9 clang::CodeGenAction::ExecuteAction() +
1257
14 clang             0x000000010717e8cf
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 991
15 clang             0x0000000107165f08
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3144
16 clang             0x000000010715d01d cc1_main(char const**, char const**,
char const*, void*) + 5341
17 clang             0x0000000107162287 main + 663
18 clang             0x000000010715bb34 start + 52
19 clang             0x0000000000000030 start + 18446744069295719728
Stack dump:
0.    Program arguments:
/Volumes/Space/Users/bungi/Source/LLVM/llvm/Release+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free
-main-file-name block-referencing-self-in-case.m -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 128.2
-coverage-file block-referencing-self-in-case.o -resource-dir
/Volumes/Space/Users/bungi/Source/LLVM/llvm/Release+Asserts/bin/../lib/clang/3.2
-fmodule-cache-path
/var/folders/3r/ts83r7g53z936m96qqd6v1rr0000gp/T/clang-module-cache
-fdebug-compilation-dir
/Volumes/Space/Users/bungi/Source/Staff/bungi/Radar/LLVM -ferror-limit 19
-fmessage-length 251 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fobjc-arc -fobjc-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
block-referencing-self-in-case.o -x objective-c
block-referencing-self-in-case.m 
1.    <eof> parser at end of file
2.    Per-function optimization
3.    Running pass 'Module Verifier' on function '@"\01-[SettingsViewController
cellForRow:]"'
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 version 3.2 (trunk 157728)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/3r/ts83r7g53z936m96qqd6v1rr0000gp/T/block-referencing-self-in-case-2egBb1.mi
clang: note: diagnostic msg:
/var/folders/3r/ts83r7g53z936m96qqd6v1rr0000gp/T/block-referencing-self-in-case-2egBb1.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