This is the mail archive of the gcc-bugs@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]

[Bug debug/43942] [4.5/4.6 Regression] -fcompare-debug faulure with external declaration in function.



------- Comment #11 from jakub at gcc dot gnu dot org  2010-04-29 20:29 -------
So, the first difference that happens is that with -g the extern var is removed
from BLOCK_VARs, with -g it is kept there.  This happens in
remove_unused_scope_block_p.  Next during inlining in remap_decls
can_be_nonlocal decides the extern var can't be non-local (remapped_type for
int is NULL at that point - int hasn't been remapped yet, so it returns false).
This is something I don't understand at all - for variably_modified_type_p
(TREE_TYPE (decl), id->src_fn) perhaps it makes sense, but aren't all other
types just remapped to itself?
Thus, remap_decls decides to remap_decl it (in -g case only) and that actually
means the remapped var makes it into REFERENCED_VARS.

One question is whether auto_var_in_fn_p should return true or false for
DECL_EXTERNAL vars with DECL_CONTEXT being the FUNCTION_DECL.  Apparently in
many places in tree-inline.c this predicate is used to tell whether the decl
should be remapped.  So, either we need something like H.J.'s patch, but with
&& !DECL_EXTERNAL (var)  (for VAR_DECL only), or e.g. tree-tailcall.c should
add a && !DECL_EXTERNAL (var) or && !is_global_var (var) check.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43942


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