C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] (SC22WG14.19250) C memory object model study group - uninitialised reads and padding

From: Jon Chesterfield <jonathanchesterfield_at_[hidden]>
Date: Tue, 13 Apr 2021 20:22:36 +0100
On Tue, Apr 13, 2021 at 7:39 PM Peter Sewell <Peter.Sewell_at_[hidden]>
wrote:

> - all other cases (i.e., those that are neither representation-byte
> accesses, padding-byte accesses, or partially initialised struct member
> accesses) of reading uninitialised variables can be regarded as programmer
> errors
>

A case I believe is missing from the enumeration involves reading off the
end of an array, from uninitialised memory, when processing an array in
chunks of multiple elements at a time. Popular with code using vector
intrinsics. Copying an uninitialised value, doing arithmetic to it, then
flushing it back to the source is quicker than explicit loop epilogues.

Received on 2021-04-13 14:22:50