Help with inserting an assignment statement at the beginning of a basic-block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am trying to insert an assignment statement at the beginning of the
basic-block in a pass that I added after the gimple pass.
I had referred to the following post :
http://gcc.gnu.org/ml/gcc-help/2011-05/msg00347.html
I used the API gsi_insert_before to do this. However, everytime I use
this API , I get the following build error
 In function ‘gimple_seq_node_d* gimple_seq_first(const_gimple_seq)’:
 error: non-trivial conversion at assignment
  char
  <unnamed type>
  # .MEM_7 = VDEF <.MEM_6(D)>
  aa_glob = 1;
  gccwk.c:99:2: internal compiler error: verify_gimple failed
  Please submit a full bug report,
  with preprocessed source if appropriate.

  I tried to search for the above error but did not find anything useful
  I am using GCC 4.7.0

My code is:

>     tree var_decl;
>     gimple_stmt_iterator si;
>     tree boolean_const;
>     gimple assign;
>     basic_block bb_start = ENTRY_BLOCK_PTR->next_bb;
>     gimple_stmt_iterator gsi = gsi_start_bb(bb_start);
>
>     // Create a global variable
>     var_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("aa_glob"),char_type_node);
>      TREE_STATIC(var_decl) = 1;
>      rest_of_decl_compilation(var_decl,1,0);
>
>      boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
>      TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
>      boolean_const = build_int_cst(boolean_type_node, 1);
>
>      // Build the assignment expression
>      assign = gimple_build_assign(var_decl,boolean_const);
>
>      // Verify the assignment statement by printing
>      print_gimple_stmt(stderr,assign,0,0);  <-------------------------- At this point I am able to see the assignment statement printed on console correctly
>
>
>      gsi_insert_before(&gsi, assign, GSI_SAME_STMT); <-------------- I get the above error only when I try to add this line of code
>

Is my usage of the API correct?

Thank you.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux