Skip to content
  • Philip Withnall's avatar
    docs: Update the documentation for G_GNUC_MALLOC to reflect recent GCC · c879f50f
    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.
    
    Signed-off-by: default avatarPhilip Withnall <withnall@endlessm.com>
    
    GNOME/glib#1465
    c879f50f