[LLVMdev] RFA: tree-nested.c

Bill Wendling isanbard at gmail.com
Tue Nov 25 15:12:53 PST 2008

I'm getting a crash with some Objective-C code that involves "blocks".
Basically, it gets to this "walk_all_functions" call and fails:

lower_nested_functions (tree fndecl, bool skip_outermost_fndecl)
  walk_all_functions (construct_reverse_callgraph, root);
  propagate_chains (root);

The construct_reverse_callgraph calls lookup_context_for_decl, where it crashes:

lookup_context_for_decl (tree fndecl)
  slot = (struct nesting_info **) htab_find_slot (ni_map, &dummy, NO_INSERT);
  gcc_assert (slot != NULL);  /* CRASHES HERE */
  return *slot;

construct_reverse_callgraph (tree *tp, int *walk_subtrees, void *data)
  switch (TREE_CODE (t))
    case ADDR_EXPR:
      /* Add an edge from the callee to the caller.  */
      pointer_set_insert (lookup_context_for_decl (decl)->callers, info);


What are the assumptions going into this "walk_all_functions" call?
Should the code have been placed into some nesting info slot or

FYI, here's the code in question:

$ cat testcase.i
typedef struct A *ARef;
@implementation bork
- (id)B {
  __attribute__((__blocks__(byref))) bork* new = ((void *)0);
- (void)C {
  __attribute__((__blocks__(byref))) id var;
  [self func:^() {}];

$ llvm-gcc -x objective-c -std=gnu99 -c testcase.i
testcase.i:9: internal compiler error: in lookup_context_for_decl, at
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

Thanks for any hints you can give!


More information about the llvm-dev mailing list