<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - "function-local metadata used in wrong function" for a small ObjC program with a block"
   href="http://llvm.org/bugs/show_bug.cgi?id=17202">17202</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"function-local metadata used in wrong function" for a small ObjC program with a block
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>glider@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat MPS.ii
@interface NSDictionary @end
@interface NSDictionary (NSExtendedDictionary)  - (NSDictionary *)allKeys; @end
@interface NSDictionary (NSDictionaryCreation)  + (id)dictionary; @end 
@protocol Cache
  - (void)completionHandler:(void (^)())handler;
@end
@interface Cache<Cache>  @end
Cache *cache;

void save() { 
  NSDictionary *data = [NSDictionary dictionary];
  [cache
   completionHandler:^(){
      if (0) {  NSDictionary *storedKeys = [data allKeys]; }
    }
  ]; 
}

-----------------------cut---------------------------

$ clang -ObjC -g -c MPS.ii -o MPS.o
function-local metadata used in wrong function
metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %1* }>**
%block.addr}
  %block.addr = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %1*
}>*, align 8
Broken module found, compilation aborted!
0  clang-3.4         0x00000001057989a8 llvm::sys::PrintStackTrace(__sFILE*) +
40
1  clang-3.4         0x0000000105798ef4 SignalHandler(int) + 644
2  libsystem_c.dylib 0x00007fff8cbe894a _sigtramp + 26
3  libsystem_c.dylib 000000000000000000 _sigtramp + 1933670096
4  clang-3.4         0x0000000105798c56 abort + 22
5  clang-3.4         0x00000001056c5beb (anonymous
namespace)::Verifier::abortIfBroken() + 523
6  clang-3.4         0x00000001056c5849 (anonymous
namespace)::Verifier::runOnFunction(llvm::Function&) + 1945
...
0.      Program arguments: <cut>/bin/clang-3.4 -cc1 -triple
x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -main-file-name
MPS.ii -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -gdwarf-2 -coverage-file <cut>/MPS.o
-resource-dir <cut>/../lib/clang/3.4 -fdebug-compilation-dir <cut>
-ferror-limit 19 -fmessage-length 164 -stack-protector 1 -mstackrealign
-fblocks -fobjc-runtime=macosx-10.8.0 -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fencode-extended-block-signature
-fobjc-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o MPS.o -x objective-c MPS.ii 
1.      <eof> parser at end of file
2.      Per-function optimization
3.      Running pass 'Module Verifier' on function '@__save_block_invoke'
clang-3.4: error: unable to execute command: Illegal instruction: 4</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>