Submitter: Douglas Walls
Submission Date: 2013-02-21
Source:WG14
Reference Document: N1675
Version: 1.0
Date:
Subject: atomic_compare_exchange: What does it mean to say two structs compare equal?
Summary
7.17.7.4 The atomic_compare_exchange generic functions7.17.7.4p2 Description
Atomically, compares the value pointed to by object for equality with
When object is an atomic struct type and expected is the corresponding
Where does the C standard define what it means for two objects of struct
7.17.7.4 NOTE 1 gives an example using memcmp on how the test for
But the padding bytes in a struct have unspecified values (6.2.6.1p6)
7.24.4.1 The memcmp function, footnote 310 reminds us that the contents
Even integers can have padding bits, whose values are unspecified (6.2.6.2p1)
A similar issue probably occurs for Atomic union types.
Suggested Technical Corrigendum
Either define equality of objects of struct type, add a restriction disallowing
use of atomic structs as arguments for the atomic_compare_exchange generic functions,
or note that atomic_compare_exchange generic functions for objects of atomic
struct type results in undefined behavior.
Previous Defect Report < - > Next Defect Report
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4