Bug 97114 - Support for vfuncs in -fanalyzer
Summary: Support for vfuncs in -fanalyzer
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: analyzer (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: David Malcolm
URL:
Keywords:
Depends on:
Blocks: analyzer-c++
  Show dependency treegraph
 
Reported: 2020-09-18 14:12 UTC by David Malcolm
Modified: 2022-02-15 22:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Malcolm 2020-09-18 14:12:55 UTC
(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)
Comment 1 David Malcolm 2020-09-18 14:29:17 UTC
There may also be some precision-of-wording issues here, when describing the chain of events in a diagnostic path.
Comment 2 GCC Commits 2021-08-18 17:41:20 UTC
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.
Comment 3 Martin Jambor 2022-02-15 22:05:14 UTC
Should this be marked as fixed?