[Bug tree-optimization/114592] [13/14 regression] Bogus `maybe-uninitialized` on std::variant with std::string with -O3

rogerio.souza at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Dec 19 19:29:56 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114592

Rogério de Souza Moraes <rogerio.souza at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rogerio.souza at gmail dot com

--- Comment #4 from Rogério de Souza Moraes <rogerio.souza at gmail dot com> ---
The "Comment 2" that the issue was fixed in the trunk, but a slight change in
the code (replacing a literal number with a variable) makes it reappear.

Example (https://godbolt.org/z/TccTrobrb):

**********************************
#include <string>
#include <variant>
#include <vector>

void fails(std::vector<std::variant<int, std::string>>& vec, int n)
{
    vec.push_back(n);
}
**********************************

Regards,
Rogerio


More information about the Gcc-bugs mailing list