C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] indeterminate value

From: Jens Gustedt <jens.gustedt_at_[hidden]>
Date: Sat, 20 Feb 2021 10:31:28 +0100
Martin,

on Sat, 20 Feb 2021 09:06:18 +0000 you ("Uecker, Martin"
<Martin.Uecker_at_[hidden]>) wrote:

> > - an lvalue conversion of an uninitialized object that is never
> > backed-up in storage (whatever that means) is undefined.
>
> You mean the "register" thing? This is very clear as
> it is semantically equivalent to "address not taken".

Unfortunately this is not really a syntactical thing, but may depend
of the interpretation which loads from memory have to be performed,
and count as "address being taken".

> > - if the object has pointer type, lvalue conversion is also
> > undefined.
>
> What is special about pointers? Any uninitialized object
> with a type with trap representations can be UB.

The problem here that this is not classical trap
representation. Whether or not a byte pattern represents a valid
pointer is dependent on the execution state. So in general, on many
architectures there is no such thing as a trap representation: any
byte pattern could represent a valid address (or a null pointer) at
some point in time.

Still there is this rule that an uninitialized pointer object has an
"indeterminate value" (respectively an "indeterminate state" if we
take your proposed changes). So lvalue conversion for it is not
defined, and this makes it a special case to consider.

Thanks
Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2021-02-20 03:31:58