This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Local variables


Hello

I am trying to create a simple integer type variable at GIMPLE level
using the following code.

tree var_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL,
get_identifier("aflatoon"), integer_type_node);
  DECL_ARTIFICIAL (var_decl) = 1;
  TREE_PUBLIC (var_decl) = 1;
  TREE_USED (var_decl) = 1;
  TREE_STATIC (var_decl) = 1;
  DECL_INITIAL (var_decl) = build_int_cst(integer_type_node, 12345);

stmt = gimple_build_bind(var_decl, cfun->gimple_body, NULL );
gsi_insert_before(&gsi, stmt, GSI_SAME_STMT);

But I am always getting the following error.

hello.c:3:5: error: invalid GIMPLE statement
{
  static int aflatoon = 12345;


}

hello.c:3:5: internal compiler error: in verify_types_in_gimple_stmt,
at tree-cfg.c:4047
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I have checked verify_type_in_gimple_stmt and it is returning true as
the stmt that is being given is of type GIMPLE_BIND
which is not there.

One more thing, I want to declare this local variable right at the
starting of main function definition but I am unable to do it. Any
help will be useful.

Regards

Abdul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]