This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve PR30911 and PR31023, Ada and VRP
- From: Arnaud Charlet <charlet at adacore dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Duncan Sands <duncan dot sands at math dot u-psud dot fr>, gcc-patches at gcc dot gnu dot org, Richard Guenther <rguenther at suse dot de>, Robert Dewar <dewar at adacore dot com>
- Date: Tue, 1 Apr 2008 09:42:56 +0200
- Subject: Re: [PATCH] Improve PR30911 and PR31023, Ada and VRP
- References: <Pine.LNX.4.64.0803291749290.4133@zhemvz.fhfr.qr> <200803301649.31731.ebotcazou@adacore.com> <200803310940.50027.duncan.sands@math.u-psud.fr> <200803312220.27682.ebotcazou@adacore.com>
> package Values is
>
> type Range_Type is range 1 .. 2;
> for Range_Type'Size use 8;
>
> function Is_Valid (X : Range_Type) return Boolean;
>
> end;
>
> package body Values is
>
> function Is_Valid (X : Range_Type) return Boolean is
> begin
> case Integer(X) is
> when 1 => return True;
> when 2 => return True;
> when others => return False;
> end case;
> end;
>
> end;
>
> is optimized to "return True;" at -O, so there won't be any quantum leap.
The above looks wrong to me: the RM has specific provision for requiring a
check in the case of "case statements", so the above case statement should
not be optimized to "return True" as far as I know.
Robert, could you confirm ?
Arno