This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Remove introduction of undefined overflow in emit_case_bit_test.
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Steven Bosscher <stevenb dot gcc at gmail dot com>
- Date: Mon, 6 Aug 2012 10:17:37 +0200
- Subject: Re: [PATCH] Remove introduction of undefined overflow in emit_case_bit_test.
- References: <501F0265.9090300@mentor.com>
On Mon, Aug 6, 2012 at 1:31 AM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> Richard,
>
> the code in emit_case_bit_tests currently introduces a MINUS_EXPR in signed type
> (without checking if signed types wrap or not), which could mean introduction of
> undefined overflow.
>
> This patch fixes this problem by performing the MINUS_EXPR in an unsigned type.
>
> Doing so also enables the vrp optimization for the test-case.
>
> Bootstrapped and reg-tested (ada inclusive) on x86_64.
>
> OK for trunk?
Ok.
Thanks,
Richard.
> Thanks,
> - Tom
>
>
> 2012-08-06 Tom de Vries <tom@codesourcery.com>
>
> * tree-switch-conversion.c (emit_case_bit_tests): Generate MINUS_EXPR in
> unsigned type.
>
> * gcc.dg/tree-ssa/vrp78.c: New test.