Hi!

On Sat, Mar 01, 2025 at 02:25:01PM -0500, Lewis Hyatt wrote:
> 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".

You're right.

It compiled with a warning:
../../gcc/ggc-common.cc: In function 'void* 
ggc_internal_cleared_alloc_no_dtor(size_t, void (*)(void*), size_t, size_t)':
../../gcc/ggc-common.cc:154:44: warning: unused parameter 'size' 
[-Wunused-parameter]
  154 | ggc_internal_cleared_alloc_no_dtor (size_t size, void (*f)(void *),
      |                                     ~~~~~~~^~~~
and obviously didn't work right (always allocated 0-sized objects).

Fixed thusly, tested on x86_64-linux with HAVE_ATTRIBUTE_ALIAS manually
commented out in auto-host.h, committed to trunk as obvious.

Sorry.

2025-03-01  Jakub Jelinek  <ja...@redhat.com>

        PR jit/117047
        * ggc-common.cc (ggc_internal_cleared_alloc_no_dtor): Pass size
        rather than s as the first argument to ggc_internal_cleared_alloc.

--- gcc/ggc-common.cc.jj        2025-03-01 11:22:20.167525459 +0100
+++ gcc/ggc-common.cc   2025-03-01 20:44:40.237969829 +0100
@@ -154,7 +154,7 @@ 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);
+  return ggc_internal_cleared_alloc (size, f, s, n PASS_MEM_STAT);
 }
 #endif
 


        Jakub

Reply via email to