[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
Sat Dec 14 00:35:00 GMT 2019


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

jcmvbkbc at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #4 from jcmvbkbc at gcc dot gnu.org ---
(In reply to Andrew Pinski from comment #2)
> The reasoning is bitmap_replace is not marked as being in the section
> .init_* at all.

Yes, and thus it should not make direct references to data which is in .init*
sections.

> GCC decides to clone it for constant-prop.  Really any
> function which is marked as __gnu_inline__ should not be marked as static or
> should be marked as always_inline instead.

I've removed __gnu_inline__ attribute, so that function definition looks like
this:

static inline 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);
}

This does not resolve the issue.


More information about the Gcc-bugs mailing list