Sub-blocks

Philip Herron redbrain@gcc.gnu.org
Fri Nov 16 15:07:00 GMT 2012


Hey guys

I've been having problems trying to create a sub block i keep getting the error:

<built-in>:0:0: internal compiler error: in gimplify_expr, at gimplify.c:7798

So far i have been playing with:

tree block_tree = make_node (BLOCK);
  tree pystmts = NULL_TREE;

  tree fndecl = current_function_decl;
  gcc_assert (fndecl != NULL_TREE);

append_to_statement_list (x, &pystmts)

 tree superblock_tree = DECL_INITIAL(fndecl);
  BLOCK_SUPERCONTEXT(block_tree) = superblock_tree;
  tree* pp;
  for (pp = &BLOCK_SUBBLOCKS(superblock_tree);
       *pp != NULL_TREE;
       pp = &BLOCK_CHAIN(*pp))
    ;
  *pp = block_tree;

  TREE_USED (block_tree) = 1;
  tree bind_tree = build3_loc (UNKNOWN_LOCATION, BIND_EXPR,
			       void_type_node, NULL_TREE,
			       NULL_TREE, block_tree);
  TREE_SIDE_EFFECTS(bind_tree) = 1;
  BIND_EXPR_BODY(bind_tree) = pystmts;
  pystmts = bind_tree;

popout of that suite then:

append_to_statement_list (bind_tree, &stmts)

I really don't understand BIND and BLOCKS i think, seems BLOCK contain
some statement list stuff and BIND brings that all together with
BLOCK_VARS and BIND_EXPR_BODY.

I have the block in between 2 labels which compile fine but when
trying to make this into a block i just really understand where iam
going wrong or what i am missing.

--Phil



More information about the Gcc-help mailing list