[Bug tree-optimization/105749] Bogus maybe-unitialized when using std::optional, regex and sstream
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 22 20:23:10 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105749
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
<source>: In function 'void t(const std::string&)':
<source>:13:51: warning: '*(int*)((char*)&port +
offsetof(std::optional<int>,std::optional<int>::<unnamed>.std::_Optional_base<int,
true, true>::<unnamed>))' may be used uninitialized [-Wmaybe-uninitialized]
13 | reqb << "Host: " << port.value_or(443) << "\r\n";
| ^~~~~~
<source>:9:28: note: '*(int*)((char*)&port +
offsetof(std::optional<int>,std::optional<int>::<unnamed>.std::_Optional_base<int,
true, true>::<unnamed>))' was declared here
9 | std::optional<int> port(i.length() > 0 ?
std::make_optional(std::strtol("99", nullptr, 10)) : std::nullopt);
| ^~~~
More information about the Gcc-bugs
mailing list