[patch] Fix PR middle-end/56474

Richard Biener richard.guenther@gmail.com
Mon Apr 15 12:26:00 GMT 2013


On Sun, Apr 14, 2013 at 10:05 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is a regression present on the mainline and 4.8 branch and introduced by
> the latest series of sizetype changes.  Associated adjustments were made in
> the various front-ends for it, most notably Ada which was the most affected,
> but this issue slipped through the cracks in the form of a bogus overflow
> detection for 0-based arrays with variable upper bound included in a record
> with discriminant.
>
> The proposed fix is to disable overflow detection in sizetype for one special
> case (0 - 1) in size_binop_loc.  An equivalent kludge was added to layout_type
> to disable overflow detection for the size expression of [0, -1] arrays.
>
> Tested on x86_64-suse-linux, OK for the mainline and 4.8 branch?

I think I already rejected this and asked you to fix the users (like
layout_type is a user).  Clearly 0 - 1 in unsigned arithmetic overflows.
Not indicating this may cause bugs elsewhere as easily as it fixes
code not dealing with this fact.

Richard.

>
> 2013-04-14  Eric Botcazou  <ebotcazou@adacore.com>
>
>         PR middle-end/56474
>         * fold-const.c (size_binop_loc): Disable overflow detection for 0 - 1.
>
>
> 2013-04-14  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gnat.dg/specs/array3.ads: New test.
>
>
> --
> Eric Botcazou



More information about the Gcc-patches mailing list