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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-04-08
   Target Milestone|---                         |7.0
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
get_int_range looks weird. First of all, it assumes tree_to_uhwi/tree_to_shwi
will always succeed, without testing, not sure if the callers guarantee you
don't get there wider types like int128_t.
Another one is that the values are stored as HOST_WIDE_INT (signed) regardless
whether the type is signed or unsigned, and then arithmetics or comparisons are
performed on it always as signed.
It seems except for recursion the type is always integer_type_node, so then the
signed vs. unsigned would be fine, but when it recurses, it uses whatever type
the arg has, and that doesn't even have to be an integral type, can be
floating, structure or whatever.  So perhaps it would be enough to just check
if TREE_TYPE (arg) is integral type with precision smaller than integer (then
look at that type), but if it is precision equal or greater than type, starting
from unsigned int and onwards, or non-integral type, just use a range of type
(== integer_type_node)?

Another thing is that ubsan should not present array types, the negation
certainly has long int type rather than long int [3].

Reply via email to