https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116945
philippe.waroquiers at skynet dot be changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |philippe.waroquiers@skynet.
| |be
--- Comment #10 from philippe.waroquiers at skynet dot be ---
(In reply to Mark Wielaard from comment #8)
> (In reply to Eric Botcazou from comment #7)
> > > Sure. But I assume the unitialized part isn't accessed when resolving the
> > > 'Valid attribute. Does checking for the 'Valid attribute depend on any
> > > uninitialized bits?
> >
> > Testing 'Valid means comparing the value with the allowed range, so how can
> > you do that without accessing that value?
>
> I don't know, my Ada foo isn't very strong. How is the allowed range
> defined? How do you test for it? Doesn't that mean the value needs to be
> defined at least for that range check? If not, is the 'Valid attribute check
> non-deterministic because you cannot rely on the value being or not being in
> the allowed range?
The allowed range is defined as part of the type or subtype definition.
For example, you can declare a new type such as:
type Month is new Integer range 1 .. 12;
The 'Valid attribute will then check that the variable is in the range.
It is for sure a little bit special to use 'Valid with non initialized values.
(a more classical usage is to check that some binary value read from a file or
network
or ... is in the allowed range).