http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46879
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2010.12.10 15:58:39 Ever Confirmed|0 |1 --- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-10 15:58:39 UTC --- (In reply to comment #3) > (In reply to comment #2) > > Hm, well. Then the debug machinery has to deal with type mismatches I > > guess. > > Well, all the debug machinery cares is that the var has the original, declared > type. > > > But I wonder why we have debug-stmts for global variables anyway? I thought > > they are only used for registers. > > It is not a global variable, it is a VAR_DECL with DECL_ABSTRACT_ORIGIN > PARM_DECL in bar, i.e. optimized away parameter/automatic variable. It is a > non-localized var in main, because it is never referenced there, except for > GIMPLE_DEBUG. Ah, ok. The fix is then to amend the 1768 if (TREE_CODE (*basep) == VAR_DECL 1769 && !auto_var_in_fn_p (*basep, current_function_decl)) check properly. The easiest check would be && !is_gimple_debug, or a auto_var_in_fn_p variant without a specific function, thus auto_var_p.