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] Fix pr23046


    I'm inclined to think this would be an error already.  If type T has
    bounds less than the precision, then there should never ever be a
    variable of type T with a true value outside those bounds.  Which
    means you should do all checking *before* you get to type T.

    I don't know if that's practical or not though.  

It's tricky because of things like the precise semantics of uninitialized
variables and things in Ada like:

	v := unchecked_convert (foo);
	if v'valid then

I think there always needs to be a way for a front end to generate the explicit
range check.  Otherwise, we're in the business of having the middle-end deal
with areas of language semantics that are very subtle.

    An alternate is to emit a VIEW_CONVERT_EXPR for the conversion, and
    document that VRP should not look through that expression.

It's not clear it can always be a V_C_E because we only really define that
when two types have the same size, but there's no requirement that a subtype
have the same size as its base type, so the conversion between the two needs
to be a regular conversion, not a V_C_E.


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