https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80378
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gcc dot gnu.org
--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Inline wrappers won't work because the second instance of pass_object_sizes
that is supposed to fully fold it is scheduled after IPA passes, and thus
information tied only to the attributes of inlined wrappers is lost.
I think it might be better to introduce __builtin_assume_object_size that can
convey such information directly in the IR. User code then can do simply:
#define alloc(a, b) __builtin_assume_object_size(alloc(a, b), a+b)
and GCC itself can properly emit such builtin for existing functions bearing
the attribute, i.e. instead of
var = malloc(size);
have in gimple explicitly:
tmp = malloc(size);
var = __builtin_assume_object_size(tmp, size);