This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE(Ada RFC)
- From: Robert Dewar <dewar at adacore dot com>
- To: Florian Weimer <fw at deneb dot enyo dot de>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, gcc at gcc dot gnu dot org
- Date: Fri, 12 Aug 2005 11:10:33 -0400
- Subject: Re: PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE(Ada RFC)
- References: <10508052145.AA11598@vlsi1.ultra.nyu.edu> <87y877dxfm.fsf@mid.deneb.enyo.de>
Florian Weimer wrote:
If this still doesn't convince you, here's an example which doesn't
use Ada.Unchecked_Conversion at all.
this example must print Success, that is guaranteed by the RM
it is definitely critical that 'Valid not make "in-range"
assumptions. the actual problem is optimization of this
routine presumably:
function bug3_p__tRP (A : bug3_p__t; F : boolean) return integer is
begin
case system__unsigned_types__unsigned!(A) is
when 2 =>
return 0;
when 3 =>
return 1;
when 5 =>
return 2;
when 7 =>
return 3;
when others =>
[constraint_error when F "invalid data"]
return -1;
end case;
end bug3_p__tRP;
the unchecked conversion to unsigned must prevent any optimization.
the optimizer must not be able to "see through" an unchecked conversion!