[Bug analyzer/98830] -Wanalyzer-null-argument on static_cast and inheritance

2021-01-26 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98830 David Malcolm changed: What|Removed |Added Last reconfirmed||2021-01-26 Ever confirmed|0

[Bug analyzer/98830] -Wanalyzer-null-argument on static_cast and inheritance

2021-01-25 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98830 --- Comment #3 from Martin Sebor --- The warning in pr98646 was determined to be a false positive at least in part because the cast was guarded by a test for the result of the call being nonnull, like so: if (p->f ()) static_cast(p->f ())-

[Bug analyzer/98830] -Wanalyzer-null-argument on static_cast and inheritance

2021-01-25 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98830 --- Comment #2 from David Malcolm --- I looked at your examples in bug 98646, and the analyzer seems to me to be working correctly. Specifically: Analyzer correctly doesn't warn for: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98646#c5 Anal

[Bug analyzer/98830] -Wanalyzer-null-argument on static_cast and inheritance

2021-01-25 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98830 --- Comment #1 from David Malcolm --- Why is it a false positive? The call to p->f () is a call to B* B::f (); and that could return NULL, hence the call to C::g would be passing NULL as 'this'. Arguably the message would be more readable as