[Bug tree-optimization/92938] constprop function is assigned to a different section than the original function

jcmvbkbc at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 8 18:02:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92938

--- Comment #7 from jcmvbkbc at gcc dot gnu.org ---
(In reply to Richard Biener from comment #6)
> (In reply to jcmvbkbc from comment #5)
> > (In reply to Andrew Pinski from comment #3)
> > > I DON'T think it is a GCC issue. The code is broken.
> > 
> > Even if I remove all attributes from this function I see this issue:
> > 
> > static void bitmap_replace(unsigned long *dst,
> >       const unsigned long *old,
> >       const unsigned long *new,
> >       const unsigned long *mask,
> >       unsigned int nbits)
> > {
> >  if ((__builtin_constant_p(nbits) && (nbits) <= 32 && (nbits) > 0))
> >   *dst = (*old & ~(*mask)) | (*new & *mask);
> >  else
> >   __bitmap_replace(dst, old, new, mask, nbits);
> > }
> > 
> > Why is it broken?
> 
> What do you expect?  That it is either inlined or a call to __bitmap_replace
> is emitted

Yes, either any of these, or if a constprop function is generated it is either
in the .init* section or it doesn't take a reference to a variable in .init*.

> (with presumably is in .init* sections?)?

It is not in .init*, but that's ok: the reference from .init to .text is
present in the original source. It's the reference from .text* to .init* which
is not present in the source but is generated by gcc that is the issue.


More information about the Gcc-bugs mailing list