[Bug c/103881] Wconversion false positive when using |= and &= with two rvalues in binary op
thomas at habets dot se
gcc-bugzilla@gcc.gnu.org
Thu Jan 20 14:56:43 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103881
--- Comment #6 from thomas at habets dot se ---
The sequence point is a bit off topic, but I can't imagine that it's the
intention to warn about `f() & f()`.
Per gcc docs it's supposed to "Warn about code that may have undefined
semantics because of violations of sequence point rules in the C and C++
standards […] Programs whose behavior depends on this have undefined behavior".
I'm not a language lawyer, but I can't imagine that it's the intention to warn
about e.g. `printf("called with %f: %s", sqrt(2), strerror(errno));`. Nor does
it sound helpful to do so.
Nor `x = get_value() & admin_bits();`. There's just no wrong but technically
conforming way to miscompile that.
More information about the Gcc-bugs
mailing list