-
Philip Withnall authored
Thanks to some great investigation by Benjamin Moody, it’s clear that our documentation and usage of G_GNUC_MALLOC has fallen behind GCC’s interpretation of the malloc attribute, meaning that recent versions of GCC could miscompile code which uses G_GNUC_MALLOC incorrectly. Update the documentation of G_GNUC_MALLOC to match the current GCC documentation (for GCC 8.2). Following commits will drop our use of G_GNUC_MALLOC from inappropriate functions. Specifically, the change in GCC’s interpretation of the malloc attribute which could cause miscompilation is that returned storage areas are now assumed to not contain valid pointers — so realloc() cannot have the malloc attribute, and neither can a function which returns a newly allocated structure with fields initialised to other pointers. (Backport to 2.56: Change the documentation to mention GLib 2.56.3 rather than GLib 2.58.) Signed-off-by: Philip Withnall <withnall@endlessm.com> #1465
3d6c8e03