http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53426
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-22
09:44:41 UTC ---
(In reply to comment #4)
> > Hum. IPA-PTA ... yeah ... :/
> >
> > Mine I guess (note ipa-pta is experimental).
> >
> > Honza - we are trying to access the varinfo for
> > _ZTIN5boost16exception_detail19error_info_injectorISt13runtime_errorEE
> > which is mentioned in the initializer of
> > _ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE
> > but that variable, despite mentioned, does not have a varpool entry. Is
> > that by design? Can we not look at the initializer of a decl via
>
> I suppose it is the case where
> _ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE is
> external but with constructor known. I recently fixed that on mainline by
> making those analyzed, too.
>
> So if this still reproduce on mainline, it is possible that you arrive to the
> constructor in some way that is not visible by varpool?
I'm arriving at it by walking all of varpool via FOR_EACH_VARIABLE, reaching
_ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE which is
readonly addressable used public ignored external virtual BLK file
/afs/cern.ch/cms/slc5_amd64_gcc470/external/boost/1.49.0/include/boost/exception/exception.hpp
line 315 col 9 size <integer_cst 0x7ffff5c07640 576> unit size <integer_cst
0x7ffff5c07740 72>
align 256 context <record_type 0x7ffff5c70930 error_info_injector> initial
<constructor 0x7ffff5c6f078>>
looking at its DECL_INITIAL which contains an address of
_ZTIN5boost16exception_detail19error_info_injectorISt13runtime_errorEE
which does not have a varpool entry and is
readonly addressable used public ignored external weak BLK file
/afs/cern.ch/cms/slc5_amd64_gcc470/external/boost/1.49.0/include/boost/exception/exception.hpp
line 315 col 9 size <integer_cst 0x7ffff5c07460 448> unit size <integer_cst
0x7ffff5c074c0 56>
align 256 initial <error_mark 0x7ffff5ad4bb8>>
it's the pointer to the typeinfo struct, so I'm not sure we ever create
varpool entries for that.
I can of course simply guard the code doing
struct varpool_node *vnode = varpool_get_node (decl);
/* For escaped variables initialize them from nonlocal. */
if (!varpool_all_refs_explicit_p (vnode))
make_copy_constraint (vi, nonlocal_id);
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!?)