[Bug c++/65866] Wrong warning when using list-initialization: operation on 'b' may be undefined [-Wsequence-point]
matthijsvanduin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jul 13 22:44:50 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65866
--- Comment #8 from Matthijs van Duin <matthijsvanduin at gmail dot com> ---
(In reply to Yuxuan Shui from comment #7)
> IIUC now wrong codegen has all been fixed? so the only thing left should be
> the diagnostic bug?
It seems so yes, the combined testcase in Bug 70796 comment 5
fails for: 9.4, 10.3, 11.2
passes for: 9.5, 10.4, 11.2.1, 12.1 and later
However the undefined behaviour warnings continue to be emitted unchanged
(including in trunk), which tbh means it barely matters whether codegen is
correct(*) since no programmer in their right mind is going to leave a
construct in their code that causes the compiler to scream "undefined
behaviour" at them.
(*) for cases where a diagnostic is emitted at least; obviously wrong codegen
without diagnostic (which also used to happen) is objectively worse than a
wrong diagnostic with correct codegen.
More information about the Gcc-bugs
mailing list