[Bug c++/103984] [12 regression] Possible maybe-uninitialized false positive on shaderc-2021.0 since r12-6329
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 26 18:35:51 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103984
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Sergei Trofimovich from comment #0)
> input_files.emplace_back(Z{
> arg.str(), // what is the lifetime of this temporary?
This prvalue initializes the 'name' member of the Z temporary, there is no
separate string temporary.
> to_stage(arg), // why does this constructor matter?
My fix for PR66139 fixed EH in aggregate initialization so that if evaluation
of to_stage(arg) throws, we properly destroy the previously initialized 'name'
member. That's the difference pinskia mentions.
It is surprising that we warn with a user-provided copy constructor and don't
with a defaulted constructor. It changes the code a bit because it means
string_piece isn't trivially copyable, so we need to create a string_piece
temporary for passing to to_stage instead of passing arg directly by bitwise
copy, but I don't know why that would confuse the optimizers into thinking that
_M_p might be uninitialized.
More information about the Gcc-bugs
mailing list