Internal compiler error when using gsi_insert_before

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

 



Hello experts,
I am trying to insert a new stmt at the beginning of a basic block in
a function.
My code is as follows:


    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);


     gsi_insert_before(&gsi, assign, GSI_SAME_STMT);


 I have verified that the assignment statement is getting printed.
 But when I try to insert the statement by using gsi_insert_before, I
always get the 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
 Any help would be greatly appreciated.

 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