http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23383
--- Comment #23 from rguenther at suse dot de <rguenther at suse dot de> 2012-01-09 08:37:21 UTC --- On Thu, 5 Jan 2012, jakub at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23383 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |jakub at gcc dot gnu.org > > --- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-05 > 18:26:17 UTC --- > But can't a valid code also compare the result from realloc with the old > pointer, and if they are equal, do something, otherwise do something else? > I think it is pretty common e.g. if the malloced block contains pointers to > parts of the malloced area and upon realloc that didn't return the passed > address wants to adjust all those pointers. Sure. > Having a malloc attribute on realloc would still break this. We cannot use the malloc attribute on realloc, ever. > I'd say we want realloc attribute and handle it where we currently handle > BUILT_IN_REALLOC. Not sure it's worth it besides handling BUILT_IN_REALLOC explicitly.