----- Message d'origine ---- De : Philip Herron <redbrain@xxxxxxxxxxx> À : Ian Lance Taylor <iant@xxxxxxxxxx> Cc : charfi asma <charfiasma@xxxxxxxx>; gcc-help@xxxxxxxxxxx Envoyé le : Mer 20 octobre 2010, 19h 52min 27s Objet : Re: [GENERIC] problem when adding 2 VAR_DEC in the main function On 20 October 2010 15:12, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > On Wed, Oct 20, 2010 at 3:30 AM, charfi asma <charfiasma@xxxxxxxx> wrote: > >> it seems that the function gimplify_var_or_parm_decl consider that I have a >> duplicate declaration. > > The error means specifically that the variable was not seen in a > BIND_EXPR. Did you add the second variable to the BIND_EXPR like the > first? Was the BIND_EXPR passed to the gimplifier? > > Put a breakpoint on gimplify_bind_expr and make sure that the variable > is seen there. > > Ian > one thing i found very useful in learning to code gcc front-ends is added debug_tree (tree) in your gimplify expression lang_hook this will print debug info about the tree's which get gimplified. --Phil Hello, thank you very much Ian and Phill, Now it works (I used the debug_tree that I find also very helpfull especially for the newbies in coding gcc fe ;) the error comes (as Ian said from the BIND_EXP) I added my 2 var decl to the same tree (declare_vars) and I used TREE_CHAIN to obtain one tree (just like the gcalc fe): tree bind = NULL_TREE; tree bl = build_block(declare_vars, NULL_TREE, main_fn_decl, NULL_TREE); DECL_INITIAL(main_fn_decl) = bl; bind = build3( BIND_EXPR, void_type_node, BLOCK_VARS(bl), NULL_TREE, bl ); now I want to add a class (a record type) with attributes and methods and after in the main I will add an object of type myclass and call one of the methods. shoud I add another bind ? is there a documentation on how to write this using generic other than the tree.def ? I will try to do it and if I get erros (hope not) I will certainly ask in the gcc-help mailing list ;) Asma