On Sat, Mar 1, 2025 at 3:41 AM Jakub Jelinek <ja...@redhat.com> wrote: > --- gcc/ggc-common.cc.jj 2025-01-02 11:23:32.505293652 +0100 > +++ gcc/ggc-common.cc 2025-02-28 12:12:20.207598711 +0100 > @@ -119,6 +119,25 @@ ggc_mark_roots (void) > } > > /* Allocate a block of memory, then clear it. */ > +#ifdef HAVE_ATTRIBUTE_ALIAS > +extern "C" void * > +ggc_internal_cleared_alloc_ (size_t size, void (*f)(void *), size_t s, > size_t n > + MEM_STAT_DECL) > +{ > + void *buf = ggc_internal_alloc (size, f, s, n PASS_MEM_STAT); > + memset (buf, 0, size); > + return buf; > +} > + > +extern void * > +ggc_internal_cleared_alloc (size_t size, void (*f)(void *), size_t s, > + size_t n MEM_STAT_DECL) > + __attribute__((__alias__ ("ggc_internal_cleared_alloc_"))); > +extern void * > +ggc_internal_cleared_alloc_no_dtor (size_t size, void (*f)(void *), > + size_t s, size_t n MEM_STAT_DECL) > + __attribute__((__alias__ ("ggc_internal_cleared_alloc_"))); > +#else > void * > ggc_internal_cleared_alloc (size_t size, void (*f)(void *), size_t s, size_t > n > MEM_STAT_DECL) > @@ -128,6 +147,17 @@ ggc_internal_cleared_alloc (size_t size, > return buf; > } > > +#ifdef __GNUC__ > +__attribute__ ((__noinline__)) > +#endif > +void * > +ggc_internal_cleared_alloc_no_dtor (size_t size, void (*f)(void *), > + size_t s, size_t n MEM_STAT_DECL) > +{ > + return ggc_internal_cleared_alloc (s, f, s, n PASS_MEM_STAT); > +} > +#endif
FYI I think there is a typo in this fallback implementation for the not-HAVE_ATTRIBUTE_ALIAS case, first argument intended to be "size" rather than "s". -Lewis