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] Remove introduction of undefined overflow in emit_case_bit_test.


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.


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