"Abhijit Nandy" <abhijit.nandy@xxxxxxxxx> writes: > So I guess DECL_EXTERNAL(var_decl) = 1 causes the var_decl to be set > as an external declaration in the following code : Yes. DECL_EXTERNAL corresponds to the "extern" storage class specifier in C/C++. > I have another question. Right now I create the following declaration > char *p; > > using : > tree temp = create_tmp_var(TREE_TYPE(TREE_TYPE(elfset_decl)), "p"); > > where elfset_decl is set to be char* in a separate function. That creates a temporary variable. > However is there another way to create a pointer to char, especially > if I want the exact identifier 'p' instead of > char * p.1; > > which the gimple pass dump is showing me. > > I tried to do it as follows : > tree var_decl1 = build_decl(UNKNOWN_LOCATION, VAR_DECL, > get_identifier("p"), char_type_node); > TREE_STATIC(var_decl1) = 0; > DECL_EXTERNAL(var_decl1) = 0; > rest_of_decl_compilation (var_decl1, 1, 0); > > But nothing appears in the gimple pass dump. I think this may be due > to not actually inserting the declaration in the tree using a gimple > function. For a local variable you don't need to call rest_of_decl_compilation. If you want a local variable which is not a temporary variable, then you need to build a BLOCK and a BIND_EXPR which define the variable in some scope. The BIND_EXPR will point to the block, and the BIND_EXPR then needs to be added into the function code somehow so that the rest of the compiler sees it. Ian