Thanks alot. That resolved the problem. Regards Abdul On Tue, Jun 28, 2011 at 12:13 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > Abdul Wahid Memon <engrwahidmemon@xxxxxxxxx> writes: > >> 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. > > Setting TREE_STATIC to 1 means that this is a file static variable, not > a function local variable. Which one do you want? > > If you want the file static variable, then you should not be calling > gimple_build_bind. If you want a function local variable, then you > should not be setting TREE_STATIC. > > Ian >