http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53426
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-22 12:47:04 UTC --- (In reply to comment #6) > > by changing it to > > > > if (!vnode > > || DECL_INITIAL (vnode) == error_mark_node > > || !varpool_all_refs_explicit_p (vnode)) > > make_copy_constraint (vi, nonlocal_id); > > > > also noting the special error_mark_node DECL_INITIAL (what's that coming > > from!?) > > DECL_INITIAL is replaced by error mark when the variable is removed from > varpool > (so we know it is no longer going to be referenced or emit in some way) to > conserve > memory. > > Other case is the partitioning, when the variable is in the other partition > and thus there is no need to sream the DECL_INITIAL (we stream DECL_INITIAL > for > variables from other partitions only when we think it may be useful for > constant > folding: that is variables passes const_value_known_p). This is probably the > case > here. > > If you only need to collect all things that escape, you can safely ignore > DECL_INITIAL of DECLs with in_ohter_partition set: all vars that are in > current > partition referenced by the constructor from other partition > "used_from_other_partition" set anyway, so they won't pass > varpool_all_refs_explicit_p. > > You only need to worry about local constructors. But I have a variable that fulfills varpool_all_refs_explicit_p but still its DECL_INITIAL contains &X where I have no varpool node for X for. So if I constant fold from it I can get an explicit reference to a global variable X that has no varpool node assigned. How can that be ok?