[Bug c/77531] __attribute__((alloc_size(1,2))) could also warn on multiplication overflow

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 13 13:55:00 GMT 2016


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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I guess the question is
1) in which pass to do this (during expansion of calls?); for SSA_NAMEs it
could perhaps use get_range_info and warn if it would always overflow (i.e. if
the minimum of arg1's range * minimum of arg2's range overflows)
2) agree on types the computation happens in; tree-object-size.c right now
casts the arguments regardless of type to sizetype, so size_t at the source
level; so, shall we do such casts and perform multiplication in size_t, or in
some other type (e.g. if both arguments are int, in int, etc.; what to do if
the arguments have different type)?


More information about the Gcc-bugs mailing list