[PATCH] Improve PR30911 and PR31023, Ada and VRP
Richard Guenther
rguenther@suse.de
Mon Mar 31 14:50:00 GMT 2008
On Mon, 31 Mar 2008, Duncan Sands wrote:
> Hi,
>
> > So I see only harm in the current non-existing middle-end semantics
> > of integral sub-types. Thus I recommend to disallow using them
> > for variables exposed to the middle-end.
>
> I have to agree, it is all just too error prone. How about having
> the Ada front-end add ASSERT_EXPR's (or maybe an equivalent builtin)
> at points where it knows an interesting bound? Unlike the current
> situation, these should mean what they say: the value is guaranteed
> to be in the range. As such they wouldn't apply to uninitialized
> variables and so forth, which would remove the need for a VRP barrier
> like VIEW_CONVERT_EXPR.
That would work and is IMHO the correct way to do it. I wanted to
expose this to C assert() in -DNDEBUG mode as __builtin_assume()
for quite some time. The easiest thing is to simply emit ASSERT_EXPRs
(though they will be removed after the first VRP pass, but that
probably doesn't matter too much).
Richard.
More information about the Gcc-patches
mailing list