-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/29/11 10:43, Jakub Jelinek wrote:
> Hi!
> 
> The following patch fixes a bug in tree-switch-conversion.c with
> signed index_expr's.  build_arrays would compute index_expr - range_min
> in index_expr's type and use that as index into CSWTCH.N array,
> which is wrong, because in this case index_expr 98 - (-62) computed
> in signed char type results in signed overflow and we end up
> loading from CSWTCH.2[-96].  Apparently for the bounds checking
> we perform the same index_expr - range_min computation, but in
> corresponding unsigned type.  This patch computes it just once in
> unsigned type, so that overflow isn't undefined.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk/4.6/4.5/4.4?
> 
> 2011-04-29  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR tree-optimization/48809
>       * tree-switch-conversion.c (build_arrays): Compute tidx in unsigned
>       type.
>       (gen_inbound_check): Don't compute index_expr - range_min in utype
>       again, instead reuse SSA_NAME initialized in build_arrays.
>       Remove two useless gsi_for_stmt calls.
> 
>       * gcc.c-torture/execute/pr48809.c: New test.
OK.

jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNuwpHAAoJEBRtltQi2kC71SAH/1VFBhEB7SXDEogMFx59LD1j
G1D+1DBL9qQEDRXMQi+aA6H8Y8WxfUDsUTQUD3rrg9HxZDEaUz55P46nc6dd/DXS
72tFm5OW5bucJbnHocxu+PeAedk8w0cmjxdnXA38ezPhqpeqUKK/ojhPPcGSErHH
7Z9YUdDHGbAcZACjvd1qTObfp4NUG0PTZ7d6+ZOsAt7RwxgECcUJuyJhZaQdxZVV
MTF96cNa205xqOIBYwGCyW5bvFhgL4kDvdUMSln2CURXyl/N+JqeGnuGEElItM+A
8ryLWBIyzuUFHNML6FK6wrROs/QPiUdan2RqDyW46WT8UdE3PgVakT/7c9E42sc=
=395m
-----END PGP SIGNATURE-----

Reply via email to