This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] tree.c: Fix latent bugs in upper_bound_in_type and lower_bound_in_type.
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, dvorakz at suse dot cz
- Date: Sat, 9 Jul 2005 10:18:47 +0200
- Subject: Re: [patch] tree.c: Fix latent bugs in upper_bound_in_type and lower_bound_in_type.
- References: <200507081359.j68Dx7B5030571@sethra.codesourcery.com>
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