On 5/31/24 06:03, Bruno Haible wrote:
Basil L. Contovounesios wrote:
Isn't this saying that C23 [[reproducible]] is stricter than GCC pure?
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm#some-differences-with-gcc-const-and-pure
Yes: [1], section "Note on GCC attributes", also claims that "pure is more
relaxed than [[reproducible]]".
Bruno
[1] https://stackoverflow.com/questions/76847905/
The stackoverflow note is merely echoing N2956, so we don't need to
worry about stackoverflow (as usual :-).
N2956 has a typo. In this statement:
"Similarly, GCC’s pure is less restricted than the new standard
attribute [[reproducible]], and an implementation of the GCC feature is,
syntax aside, an implementation of the new standard attribute."
The words "less restricted" should be "stricter", or (if you prefer)
"less restricted in the constraints it places on GCC's optimizations".
The context makes this clear.
It's too bad that C23's description of [[reproducible]] and
[[unsequenced]] is so opaque that we're reduced to reading N2956 to try
to figure out what's going on. It's also too bad that N2956 has this
typo, and that it doesn't mention GCC's returns-exactly-once constraints
on pure and const functions.