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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|libstdc++                   |target
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.2

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. with GCC 6 and later you get the same behaviour for <stdlib.h> because
that includes <cstdlib> now.

My tests on AIX 7.1.3.0 were not the same GCC version, it looks like this was
fixed for GCC 6.2.0 by r233029 (and r237394 on trunk). The fixed header now
has:

# 748
"/home/jwakely/gcc/6/lib/gcc/powerpc-ibm-aix7.2.0.0/6.3.1/include-fixed/stdlib.h"
3 4
extern void *__linux_malloc(size_t);
extern void *__linux_realloc(void *, size_t);
extern void *__linux_calloc(size_t, size_t);
extern void *__linux_valloc(size_t);

extern void *malloc(size_t) __asm__("__linux_malloc");
extern void *calloc(size_t, size_t) __asm__("__linux_calloc");
extern void *realloc(void *, size_t) __asm__("__linux_realloc");
extern void *valloc(size_t) __asm__("__linux_valloc");

This is necessary because the C++ standard explicitly forbids malloc and other
functions from the C library from being defined as macros, they must be defined
as functions.

Reply via email to