This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] tree.c: Fix latent bugs in upper_bound_in_type and lower_bound_in_type.


Hello,

calling these functions when TREE_PRECISION (outer) < TREE_PRECISION (inner)
is wrong, and should not happen (i.e. inserting the assert that this is
the case might be a good idea).  So the only case that might be
relevant that your patch attempts to fix is:

> Similarly, for upper_bound_in_type.
> 
> widening? outer uns? inner uns? upper bound
> -----------------------------------------------------------------
> yes       yes        no         2^OP-1     <- used to be 2^IP-1

which indeed needs to be fixed; but the fix is much easier, just
replace

> !   if (TYPE_UNSIGNED (outer) || TYPE_UNSIGNED (inner))

with

> !   if (TYPE_UNSIGNED (outer) && TYPE_UNSIGNED (inner))

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]