This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Update string_constant for new const initializer code
> No, that wasn't my question either. My question was that when
> DECL_REPLACEABLE_P is set why we care for the varpool info at all.
> And if it is not set why isn't it enough to look at
> DECL_INITIAL.
Ah, hopefully I gave answer to that too ;)
> > at source level might get partitioned into multiple units (as result of
> > inlining or so). Then it is defined in one unit where it appears as:
> >
> > hidden const int a;
> >
> > In all other units it apepar as:
> >
> > extern hidden const int a;
> >
> > Still we want to fold references to A into constant.
>
> But both will have DECL_INITIAL set and both will be !DECL_REPLACEABLE_P
> (at least I hope so).
No, those don't have DECL_INITIAL (they are initialized to 0). Moreover even
extern const int a=5; (i.e. with DECL_INITIAL) is still DECL_REPLACEABLE
because it is !binds_local_p.
>
> Is binds_local_p equivalent to !DECL_REPLACEABLE_P?
No, as you found later yourself ;)
>
> I don't have good ideas here but just notice that the recent patches
> here add, not remove, from the confusion of mine.
Yep, it is all surprisingly stubble ;(
Honza
>
> Richard.