[Bug libstdc++/108554] Warning "null pointer dereferece" raised when extracting a unique_ptr from a map and any "-O" flag

fcontact at cuveland dot de gcc-bugzilla@gcc.gnu.org
Thu Jan 26 09:56:24 GMT 2023


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

--- Comment #2 from Jan de Cuveland <fcontact at cuveland dot de> ---
Thanks for the insight!

Adding a check on empty() for my_map.extract(it) resolves the issue.

So it is just that the static analyzer does not see that (to my understanding)
"it" has to be a valid iterator and thus will always result in a non-empty node
handle.


More information about the Gcc-bugs mailing list