(Similar to PR analyzer/97113 which covers RTTI in general) -fanalyzer doesn't yet "know about" virtual functions; it probably ought to be able to devirtualization calls, or speculate about likely calls. Probably need to reuse/refactor logic in ipa-devirt.c for this. (Filing this as part of the -fanalyzer C++ tracker bug)
There may also be some precision-of-wording issues here, when describing the chain of events in a diagnostic path.
The master branch has been updated by Ankur saini <arsenic@gcc.gnu.org>: https://gcc.gnu.org/g:1b34248527472496ca3fe2a07183beac8cf69041 commit r12-3003-g1b34248527472496ca3fe2a07183beac8cf69041 Author: Ankur Saini <arsenic@sourceware.org> Date: Sun Aug 15 19:19:07 2021 +0530 analyzer: detect and analyze virtual function calls 2021-08-15 Ankur Saini <arsenic@sourceware.org> gcc/analyzer/ChangeLog: PR analyzer/97114 * region-model.cc (region_model::get_rvalue_1): Add case for OBJ_TYPE_REF. gcc/testsuite/ChangeLog: PR analyzer/97114 * g++.dg/analyzer/vfunc-2.C: New test. * g++.dg/analyzer/vfunc-3.C: New test. * g++.dg/analyzer/vfunc-4.C: New test. * g++.dg/analyzer/vfunc-5.C: New test.
Should this be marked as fixed?