LCOV - code coverage report
Current view: top level - gcc/analyzer - region.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 92.9 % 323 300
Test Date: 2026-11-14 16:39:50 Functions: 91.4 % 81 74
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Regions of memory.
       2              :    Copyright (C) 2019-2026 Free Software Foundation, Inc.
       3              :    Contributed by David Malcolm <dmalcolm@redhat.com>.
       4              : 
       5              : This file is part of GCC.
       6              : 
       7              : GCC is free software; you can redistribute it and/or modify it
       8              : under the terms of the GNU General Public License as published by
       9              : the Free Software Foundation; either version 3, or (at your option)
      10              : any later version.
      11              : 
      12              : GCC is distributed in the hope that it will be useful, but
      13              : WITHOUT ANY WARRANTY; without even the implied warranty of
      14              : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15              : General Public License for more details.
      16              : 
      17              : You should have received a copy of the GNU General Public License
      18              : along with GCC; see the file COPYING3.  If not see
      19              : <http://www.gnu.org/licenses/>.  */
      20              : 
      21              : #ifndef GCC_ANALYZER_REGION_H
      22              : #define GCC_ANALYZER_REGION_H
      23              : 
      24              : #include "analyzer/symbolic-nodes.h"
      25              : #include "analyzer/store.h"
      26              : #include "analyzer/concrete-ranges.h"
      27              : #include "analyzer/symbolic-memory-offsets.h"
      28              : #include "analyzer/symbolic-memory-ranges.h"
      29              : #include "analyzer/symbolic-pointers.h"
      30              : 
      31              : namespace ana {
      32              : 
      33              : /* An enum for identifying different spaces within memory.  */
      34              : 
      35              : enum memory_space
      36              : {
      37              :   MEMSPACE_UNKNOWN,
      38              :   MEMSPACE_CODE,
      39              :   MEMSPACE_GLOBALS,
      40              :   MEMSPACE_STACK,
      41              :   MEMSPACE_HEAP,
      42              :   MEMSPACE_READONLY_DATA,
      43              :   MEMSPACE_THREAD_LOCAL,
      44              :   MEMSPACE_PRIVATE
      45              : };
      46              : 
      47              : /* An enum for discriminating between the different concrete subclasses
      48              :    of region.  */
      49              : 
      50              : enum region_kind
      51              : {
      52              :   RK_FRAME,
      53              :   RK_GLOBALS,
      54              :   RK_CODE,
      55              :   RK_FUNCTION,
      56              :   RK_LABEL,
      57              :   RK_STACK,
      58              :   RK_HEAP,
      59              :   RK_THREAD_LOCAL,
      60              :   RK_ROOT,
      61              :   RK_SYMBOLIC,
      62              :   RK_DECL,
      63              :   RK_FIELD,
      64              :   RK_ELEMENT,
      65              :   RK_OFFSET,
      66              :   RK_SIZED,
      67              :   RK_CAST,
      68              :   RK_HEAP_ALLOCATED,
      69              :   RK_ALLOCA,
      70              :   RK_STRING,
      71              :   RK_BIT_RANGE,
      72              :   RK_VAR_ARG,
      73              :   RK_ERRNO,
      74              :   RK_PRIVATE,
      75              :   RK_UNKNOWN,
      76              : };
      77              : 
      78              : /* Region and its subclasses.
      79              : 
      80              :    The class hierarchy looks like this (using indentation to show
      81              :    inheritance, and with region_kinds shown for the concrete subclasses):
      82              : 
      83              :    region
      84              :      space_region
      85              :        frame_region (RK_FRAME): a function frame on the stack
      86              :        globals_region (RK_GLOBALS): holds globals variables (data and bss)
      87              :        code_region (RK_CODE): represents the code segment, containing functions
      88              :        stack_region (RK_STACK): a stack, containing all stack frames
      89              :        heap_region (RK_HEAP): the heap, containing heap_allocated_regions
      90              :        thread_local_region (RK_THREAD_LOCAL): thread-local data for the thread
      91              :                                               being analyzed
      92              :      root_region (RK_ROOT): the top-level region
      93              :      function_region (RK_FUNCTION): the code for a particular function
      94              :      label_region (RK_LABEL): a particular label within a function
      95              :      symbolic_region (RK_SYMBOLIC): dereferencing a symbolic pointer
      96              :      decl_region (RK_DECL): the memory occupied by a particular global, local,
      97              :                             or SSA name
      98              :      field_region (RK_FIELD): the memory occupied by a field within a struct
      99              :                               or union
     100              :      element_region (RK_ELEMENT): an element within an array
     101              :      offset_region (RK_OFFSET): a byte-offset within another region, for
     102              :                                 handling pointer arithmetic as a region
     103              :      sized_region (RK_SIZED): a subregion of symbolic size (in bytes)
     104              :                               within its parent
     105              :      cast_region (RK_CAST): a region that views another region using a
     106              :                             different type
     107              :      heap_allocated_region (RK_HEAP_ALLOCATED): an untyped region dynamically
     108              :                                                 allocated on the heap via
     109              :                                                 "malloc" or similar
     110              :      alloca_region (RK_ALLOCA): an untyped region dynamically allocated on the
     111              :                                 stack via "alloca"
     112              :      string_region (RK_STRING): a region for a STRING_CST
     113              :      bit_range_region (RK_BIT_RANGE): a region for a specific range of bits
     114              :                                       within another region
     115              :      var_arg_region (RK_VAR_ARG): a region for the N-th vararg within a
     116              :                                   frame_region for a variadic call
     117              :      errno_region (RK_ERRNO): a region for holding "errno"
     118              :      private_region (RK_PRIVATE): a region for internal state of an API
     119              :      unknown_region (RK_UNKNOWN): for handling unimplemented tree codes.  */
     120              : 
     121              : /* Abstract base class for representing ways of accessing chunks of memory.
     122              : 
     123              :    Regions form a tree-like hierarchy, with a root region at the base,
     124              :    with memory space regions within it, representing the stack and
     125              :    globals, with frames within the stack, and regions for variables
     126              :    within the frames and the "globals" region.  Regions for structs
     127              :    can have subregions for fields.  */
     128              : 
     129              : class region : public symbolic::node
     130              : {
     131              : public:
     132              :   using symbolic_bit_count = symbolic::scalar<integer_with_unit<units::bit>>;
     133              :   using symbolic_byte_count = symbolic::scalar<integer_with_unit<units::byte>>;
     134              : 
     135              :   virtual ~region ();
     136              : 
     137              :   virtual enum region_kind get_kind () const = 0;
     138              :   virtual const frame_region *
     139      1349813 :   dyn_cast_frame_region () const { return nullptr; }
     140              :   virtual const function_region *
     141        23038 :   dyn_cast_function_region () const { return nullptr; }
     142              :   virtual const symbolic_region *
     143     15318993 :   dyn_cast_symbolic_region () const { return nullptr; }
     144              :   virtual const decl_region *
     145       558951 :   dyn_cast_decl_region () const { return nullptr; }
     146              :   virtual const field_region *
     147            0 :   dyn_cast_field_region () const { return nullptr; }
     148              :   virtual const element_region *
     149        34739 :   dyn_cast_element_region () const { return nullptr; }
     150              :   virtual const offset_region *
     151        32216 :   dyn_cast_offset_region () const { return nullptr; }
     152              :   virtual const sized_region *
     153            0 :   dyn_cast_sized_region () const { return nullptr; }
     154              :   virtual const cast_region *
     155        46994 :   dyn_cast_cast_region () const { return nullptr; }
     156              :   virtual const string_region *
     157        11091 :   dyn_cast_string_region () const { return nullptr; }
     158              :   virtual const bit_range_region *
     159            0 :   dyn_cast_bit_range_region () const { return nullptr; }
     160              :   virtual const var_arg_region *
     161          577 :   dyn_cast_var_arg_region () const { return nullptr; }
     162              : 
     163              :   void print_dump_widget_label (pretty_printer *pp) const final override;
     164              :   virtual void print_region_for_dump_widget_label (pretty_printer *pp) const = 0;
     165              :   void
     166              :   add_dump_widget_children (text_art::tree_widget &,
     167              :                             symbolic::node_dump_state &nds) const final override;
     168              :   const char *
     169        26275 :   get_any_dump_color () const override { return "region"; }
     170              : 
     171              :   virtual void accept (visitor *v) const;
     172              : 
     173     89767346 :   const region *get_parent_region () const { return m_parent; }
     174              :   const region *get_base_region () const;
     175              :   bool base_region_p () const;
     176              :   bool descendent_of_p (const region *elder) const;
     177              :   const frame_region *maybe_get_frame_region () const;
     178              :   enum memory_space get_memory_space () const;
     179              :   bool can_have_initial_svalue_p () const;
     180              :   const svalue *get_initial_value_at_main (region_model_manager *mgr) const;
     181              : 
     182              :   tree maybe_get_decl () const;
     183              : 
     184      8441892 :   tree get_type () const { return m_type; }
     185              : 
     186              :   void print (const region_model &model,
     187              :               pretty_printer *pp) const;
     188              :   label_text get_desc (bool simple=true) const;
     189              : 
     190              :   virtual void dump_to_pp (pretty_printer *pp, bool simple) const = 0;
     191              :   void dump (bool simple) const;
     192              :   void dump () const;
     193              : 
     194              :   bool maybe_print_for_user (pretty_printer *pp,
     195              :                              const region_model &model) const;
     196              : 
     197              :   bool non_null_p () const;
     198              : 
     199              :   static int cmp_ptr_ptr (const void *, const void *);
     200              : 
     201              :   symbolic::memory_offset
     202              :   get_memory_offset (region_model_manager &mgr) const;
     203              : 
     204              :   symbolic::memory_range
     205              :   get_memory_range (region_model_manager &mgr) const;
     206              : 
     207              :   symbolic::pointer
     208              :   get_pointer (region_model_manager &mgr) const;
     209              : 
     210              :   /* Attempt to get the size of this region in bytes.
     211              :      This is the accessed size, not necessarily the size that's valid to
     212              :      access.  */
     213              :   virtual const symbolic_byte_size *
     214              :   maybe_get_byte_size (symbolic::scalar_manager<concrete_byte_size> &byte_mgr) const;
     215              : 
     216              :   /* Attempt to get the size of this region in bits.
     217              :      This is the accessed size, not necessarily the size that's valid to
     218              :      access.  */
     219              :   virtual const symbolic_bit_size *
     220              :   maybe_get_bit_size (symbolic::scalar_manager<concrete_bit_size> &bit_mgr) const;
     221              : 
     222              :   /* Get a symbolic value describing the size of this region in bytes
     223              :      (which could be "unknown").
     224              :      This is the accessed size, not necessarily the size that's valid to
     225              :      access.  */
     226              :   const svalue *get_byte_size_sval (region_model_manager *mgr) const;
     227              : 
     228              :   virtual const symbolic_bit_count *
     229              :   maybe_get_bit_offset_relative_to_parent (region_model_manager &mgr) const;
     230              : 
     231              :   virtual const symbolic_byte_count *
     232              :   maybe_get_byte_offset_relative_to_parent (region_model_manager &mgr) const;
     233              : 
     234              :   void
     235              :   get_subregions_for_bit_range (region_model_manager *mgr,
     236              :                                 concrete_bit_range relative_bit_range,
     237              :                                 tree type,
     238              :                                 auto_vec <const region *> *out) const;
     239              : 
     240              :   bool symbolic_for_unknown_ptr_p () const;
     241              : 
     242              :   bool symbolic_p () const;
     243              : 
     244              :   /* For most base regions it makes sense to track the bindings of the region
     245              :      within the store.  As an optimization, some are not tracked (to avoid
     246              :      bloating the store object with redundant binding clusters).  */
     247       458631 :   virtual bool tracked_p () const { return true; }
     248              : 
     249              :   bool is_named_decl_p (const char *decl_name) const;
     250              : 
     251              :   bool empty_p (region_model_manager &mgr) const;
     252              : 
     253              :  protected:
     254              :   region (complexity c, symbolic::node::id_t id, const region *parent, tree type);
     255              : 
     256              :   std::unique_ptr<json::object>
     257              :   make_json_obj (const char *type_name) const;
     258              : 
     259              :  private:
     260              :   symbolic::memory_offset
     261              :   calc_memory_offset (symbolic::node_manager &mgr) const;
     262              : 
     263              :   symbolic::memory_range
     264              :   calc_memory_range (symbolic::node_manager &mgr) const;
     265              : 
     266              :   symbolic::pointer
     267              :   calc_pointer (symbolic::node_manager &mgr) const;
     268              : 
     269              :   const svalue *calc_initial_value_at_main (region_model_manager *mgr) const;
     270              : 
     271              :   virtual void
     272              :   add_dump_widget_children_for_region (text_art::tree_widget &,
     273              :                                        symbolic::node_dump_state &nds) const;
     274              : 
     275              :   const region *m_parent;
     276              :   tree m_type;
     277              : 
     278              :   mutable std::unique_ptr<symbolic::memory_offset> m_cached_memory_offset;
     279              :   mutable std::unique_ptr<symbolic::memory_range> m_cached_memory_range;
     280              :   mutable std::unique_ptr<symbolic::pointer> m_cached_pointer;
     281              : 
     282              :   /* For regions within a global decl, a cache of the svalue for the initial
     283              :      value of this region when the program starts.  */
     284              :   mutable const svalue *m_cached_init_sval_at_main;
     285              : };
     286              : 
     287              : } // namespace ana
     288              : 
     289              : template <>
     290              : template <>
     291              : inline bool
     292              : is_a_helper <const region *>::test (const region *)
     293              : {
     294              :   return true;
     295              : }
     296              : 
     297              : namespace ana {
     298              : 
     299              : /* Abstract subclass of region, for regions that represent an untyped
     300              :    space within memory, such as the stack or the heap.  */
     301              : 
     302        40857 : class space_region : public region
     303              : {
     304              : protected:
     305        40857 :   space_region (symbolic::node::id_t id, const region *parent)
     306        40857 :   : region (complexity (parent), id, parent, NULL_TREE)
     307        40857 :   {}
     308              : };
     309              : 
     310              : /* Concrete space_region subclass, representing a function frame on the stack,
     311              :    to contain the locals.
     312              :    The parent is the stack region; there's also a hierarchy of call-stack
     313              :    prefixes expressed via m_calling_frame.
     314              :    For example, given "oldest" calling "middle" called "newest" we would have
     315              :    - a stack depth of 3
     316              :    - frame (A) for "oldest" with index 0 for depth 1, calling_frame == NULL
     317              :    - frame (B) for "middle" with index 1 for depth 2, calling_frame == (A)
     318              :    - frame (C) for "newest" with index 2 for depth 3, calling_frame == (B)
     319              :    where the parent region for each of the frames is the "stack" region.
     320              :    The index is the count of frames earlier than this in the stack.  */
     321              : 
     322              : class frame_region : public space_region
     323              : {
     324              : public:
     325              :   /* A support class for uniquifying instances of frame_region.  */
     326              :   struct key_t
     327              :   {
     328        41727 :     key_t (const frame_region *calling_frame, const function &fun)
     329        41727 :     : m_calling_frame (calling_frame), m_fun (&fun)
     330              :     {
     331              :       /* calling_frame can be nullptr.  */
     332              :     }
     333              : 
     334       286133 :     hashval_t hash () const
     335              :     {
     336       286133 :       inchash::hash hstate;
     337       286133 :       hstate.add_ptr (m_calling_frame);
     338       286133 :       hstate.add_ptr (m_fun);
     339       286133 :       return hstate.end ();
     340              :     }
     341              : 
     342       257019 :     bool operator== (const key_t &other) const
     343              :     {
     344       257019 :       return (m_calling_frame == other.m_calling_frame
     345       257019 :               && m_fun == other.m_fun);
     346              :     }
     347              : 
     348              :     void mark_deleted () { m_fun = reinterpret_cast<function *> (1); }
     349            0 :     void mark_empty () { m_fun = nullptr; }
     350       319761 :     bool is_deleted () const
     351              :     {
     352       319761 :       return m_fun == reinterpret_cast<function *> (1);
     353              :     }
     354      1285172 :     bool is_empty () const { return m_fun == nullptr; }
     355              : 
     356              :     const frame_region *m_calling_frame;
     357              :     const function *m_fun;
     358              :   };
     359              : 
     360        18812 :   frame_region (symbolic::node::id_t id, const region *parent,
     361              :                 const frame_region *calling_frame,
     362              :                 const function &fun, int index)
     363        18812 :   : space_region (id, parent), m_calling_frame (calling_frame),
     364        18812 :     m_fun (fun), m_index (index)
     365        18812 :   {}
     366              :   ~frame_region ();
     367              : 
     368              :   /* region vfuncs.  */
     369      7973278 :   enum region_kind get_kind () const final override { return RK_FRAME; }
     370      1051064 :   const frame_region * dyn_cast_frame_region () const final override
     371              :   {
     372      1051064 :     return this;
     373              :   }
     374              :   void accept (visitor *v) const final override;
     375              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     376              : 
     377              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     378              :   void
     379              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     380              : 
     381              :   std::unique_ptr<json::object>
     382              :   to_json () const final override;
     383              : 
     384              :   std::unique_ptr<diagnostics::markup::node>
     385              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     386              : 
     387              :   /* Accessors.  */
     388      4414065 :   const frame_region *get_calling_frame () const { return m_calling_frame; }
     389      4666981 :   const function &get_function () const { return m_fun; }
     390         1030 :   tree get_fndecl () const { return get_function ().decl; }
     391     13146083 :   int get_index () const { return m_index; }
     392      4958647 :   int get_stack_depth () const { return m_index + 1; }
     393              : 
     394              :   const decl_region *
     395              :   get_region_for_local (region_model_manager *mgr,
     396              :                         tree expr,
     397              :                         const region_model_context *ctxt) const;
     398              : 
     399            6 :   unsigned get_num_locals () const { return m_locals.elements (); }
     400              : 
     401              :   /* Implemented in region-model-manager.cc.  */
     402              :   void dump_untracked_regions () const;
     403              : 
     404              :  private:
     405              :   const frame_region *m_calling_frame;
     406              :   const function &m_fun;
     407              :   int m_index;
     408              : 
     409              :   /* The regions for the decls within this frame are managed by this
     410              :      object, rather than the region_model_manager, to make it a simple
     411              :      lookup by tree.  */
     412              :   typedef hash_map<tree, decl_region *> map_t;
     413              :   map_t m_locals;
     414              : };
     415              : 
     416              : } // namespace ana
     417              : 
     418              : template <>
     419              : template <>
     420              : inline bool
     421          625 : is_a_helper <const frame_region *>::test (const region *reg)
     422              : {
     423          625 :   return reg->get_kind () == RK_FRAME;
     424              : }
     425              : 
     426              : template <> struct default_hash_traits<frame_region::key_t>
     427              : : public member_function_hash_traits<frame_region::key_t>
     428              : {
     429              :   static const bool empty_zero_p = true;
     430              : };
     431              : 
     432              : namespace ana {
     433              : 
     434              : /* Concrete space_region subclass, to hold global variables (data and bss).  */
     435              : 
     436         4409 : class globals_region : public space_region
     437              : {
     438              :  public:
     439         4409 :   globals_region (symbolic::node::id_t id, const region *parent)
     440         4409 :   : space_region (id, parent)
     441              :   {}
     442              : 
     443              :   /* region vfuncs.  */
     444       896442 :   enum region_kind get_kind () const final override { return RK_GLOBALS; }
     445              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     446              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     447              :   void
     448              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     449              : 
     450              :   std::unique_ptr<json::object>
     451              :   to_json () const final override;
     452              : 
     453              :   std::unique_ptr<diagnostics::markup::node>
     454              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     455              : };
     456              : 
     457              : } // namespace ana
     458              : 
     459              : template <>
     460              : template <>
     461              : inline bool
     462              : is_a_helper <const globals_region *>::test (const region *reg)
     463              : {
     464              :   return reg->get_kind () == RK_GLOBALS;
     465              : }
     466              : 
     467              : namespace ana {
     468              : 
     469              : /* Concrete space_region subclass, representing the code segment
     470              :    containing functions.  */
     471              : 
     472         4409 : class code_region : public space_region
     473              : {
     474              : public:
     475         4409 :   code_region (symbolic::node::id_t id, const region *parent)
     476         4409 :   : space_region (id, parent)
     477              :   {}
     478              : 
     479              :   /* region vfuncs.  */
     480              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     481              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     482              :   void
     483              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     484              :   std::unique_ptr<json::object>
     485              :   to_json () const final override;
     486              : 
     487              :   std::unique_ptr<diagnostics::markup::node>
     488              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     489              : 
     490        23934 :   enum region_kind get_kind () const final override { return RK_CODE; }
     491              : };
     492              : 
     493              : } // namespace ana
     494              : 
     495              : template <>
     496              : template <>
     497              : inline bool
     498              : is_a_helper <const code_region *>::test (const region *reg)
     499              : {
     500              :   return reg->get_kind () == RK_CODE;
     501              : }
     502              : 
     503              : namespace ana {
     504              : 
     505              : /* Concrete region subclass.  A region representing the code for
     506              :    a particular function.  */
     507              : 
     508              : class function_region : public region
     509              : {
     510              : public:
     511        10576 :   function_region (symbolic::node::id_t id, const code_region *parent, tree fndecl)
     512        21152 :   : region (complexity (parent), id, parent, TREE_TYPE (fndecl)),
     513        10576 :     m_fndecl (fndecl)
     514              :   {
     515        10576 :     gcc_assert (FUNC_OR_METHOD_TYPE_P (TREE_TYPE (fndecl)));
     516        10576 :   }
     517              : 
     518              :   /* region vfuncs.  */
     519              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     520              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     521              :   void
     522              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     523              :   std::unique_ptr<json::object>
     524              :   to_json () const final override;
     525              : 
     526              :   std::unique_ptr<diagnostics::markup::node>
     527              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     528              : 
     529       108800 :   enum region_kind get_kind () const final override { return RK_FUNCTION; }
     530              :   const function_region *
     531       886877 :   dyn_cast_function_region () const final override{ return this; }
     532              : 
     533       886581 :   tree get_fndecl () const { return m_fndecl; }
     534              : 
     535              : private:
     536              :   tree m_fndecl;
     537              : };
     538              : 
     539              : } // namespace ana
     540              : 
     541              : template <>
     542              : template <>
     543              : inline bool
     544           10 : is_a_helper <const function_region *>::test (const region *reg)
     545              : {
     546           10 :   return reg->get_kind () == RK_FUNCTION;
     547              : }
     548              : 
     549              : namespace ana {
     550              : 
     551              : /* Concrete region subclass.  A region representing a particular label
     552              :    within a function.  */
     553              : 
     554              : class label_region : public region
     555              : {
     556              : public:
     557           50 :   label_region (symbolic::node::id_t id, const function_region *parent, tree label)
     558           50 :   : region (complexity (parent), id, parent, NULL_TREE), m_label (label)
     559              :   {
     560           50 :     gcc_assert (TREE_CODE (label) == LABEL_DECL);
     561           50 :   }
     562              : 
     563              :   /* region vfuncs.  */
     564              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     565              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     566              :   void
     567              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     568              :   std::unique_ptr<json::object>
     569              :   to_json () const final override;
     570              :   std::unique_ptr<diagnostics::markup::node>
     571              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     572              : 
     573         4740 :   enum region_kind get_kind () const final override { return RK_LABEL; }
     574              : 
     575            5 :   tree get_label () const { return m_label; }
     576              : 
     577              : private:
     578              :   tree m_label;
     579              : };
     580              : 
     581              : } // namespace ana
     582              : 
     583              : template <>
     584              : template <>
     585              : inline bool
     586            5 : is_a_helper <const label_region *>::test (const region *reg)
     587              : {
     588            5 :   return reg->get_kind () == RK_LABEL;
     589              : }
     590              : 
     591              : namespace ana {
     592              : 
     593              : /* Concrete space_region subclass representing a stack, containing all stack
     594              :    frames.  */
     595              : 
     596         4409 : class stack_region : public space_region
     597              : {
     598              : public:
     599         4409 :   stack_region (symbolic::node::id_t id, region *parent)
     600         4409 :   : space_region (id, parent)
     601              :   {}
     602              : 
     603              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     604              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     605              :   void
     606              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     607              :   std::unique_ptr<json::object>
     608              :   to_json () const final override;
     609              :   std::unique_ptr<diagnostics::markup::node>
     610              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     611              : 
     612       551538 :   enum region_kind get_kind () const final override { return RK_STACK; }
     613              : };
     614              : 
     615              : } // namespace ana
     616              : 
     617              : template <>
     618              : template <>
     619              : inline bool
     620              : is_a_helper <const stack_region *>::test (const region *reg)
     621              : {
     622              :   return reg->get_kind () == RK_STACK;
     623              : }
     624              : 
     625              : namespace ana {
     626              : 
     627              : /* Concrete space_region subclass: a region within which regions can be
     628              :    dynamically allocated.  */
     629              : 
     630         4409 : class heap_region : public space_region
     631              : {
     632              : public:
     633         4409 :   heap_region (symbolic::node::id_t id, region *parent)
     634         4409 :   : space_region (id, parent)
     635              :   {}
     636              : 
     637       653496 :   enum region_kind get_kind () const final override { return RK_HEAP; }
     638              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     639              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     640              :   std::unique_ptr<json::object>
     641              :   to_json () const final override;
     642              :   std::unique_ptr<diagnostics::markup::node>
     643              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     644              : 
     645              :   void
     646              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     647              : };
     648              : 
     649              : } // namespace ana
     650              : 
     651              : template <>
     652              : template <>
     653              : inline bool
     654              : is_a_helper <const heap_region *>::test (const region *reg)
     655              : {
     656              :   return reg->get_kind () == RK_HEAP;
     657              : }
     658              : 
     659              : namespace ana {
     660              : 
     661              : /* Concrete space_region subclass: thread-local data for the thread
     662              :    being analyzed.  */
     663              : 
     664         4409 : class thread_local_region : public space_region
     665              : {
     666              : public:
     667         4409 :   thread_local_region (symbolic::node::id_t id, region *parent)
     668         4409 :   : space_region (id, parent)
     669              :   {}
     670              : 
     671        82573 :   enum region_kind get_kind () const final override { return RK_THREAD_LOCAL; }
     672              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     673              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     674              :   void
     675              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     676              :   std::unique_ptr<json::object>
     677              :   to_json () const final override;
     678              :   std::unique_ptr<diagnostics::markup::node>
     679              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     680              : };
     681              : 
     682              : } // namespace ana
     683              : 
     684              : template <>
     685              : template <>
     686              : inline bool
     687              : is_a_helper <const thread_local_region *>::test (const region *reg)
     688              : {
     689              :   return reg->get_kind () == RK_THREAD_LOCAL;
     690              : }
     691              : 
     692              : namespace ana {
     693              : 
     694              : /* Concrete region subclass.  The root region, containing all regions
     695              :    (either directly, or as descendents).
     696              :    Unique within a region_model_manager.  */
     697              : 
     698         4409 : class root_region : public region
     699              : {
     700              : public:
     701              :   root_region (symbolic::node::id_t id);
     702              : 
     703      3082253 :   enum region_kind get_kind () const final override { return RK_ROOT; }
     704              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     705              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     706              : 
     707              :   void
     708              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     709              : 
     710              :   std::unique_ptr<json::object>
     711              :   to_json () const final override;
     712              : 
     713              :   std::unique_ptr<diagnostics::markup::node>
     714              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     715              : };
     716              : 
     717              : } // namespace ana
     718              : 
     719              : template <>
     720              : template <>
     721              : inline bool
     722              : is_a_helper <const root_region *>::test (const region *reg)
     723              : {
     724              :   return reg->get_kind () == RK_ROOT;
     725              : }
     726              : 
     727              : namespace ana {
     728              : 
     729              : /* Concrete region subclass: a region to use when dereferencing an unknown
     730              :    pointer.  */
     731              : 
     732              : class symbolic_region : public region
     733              : {
     734              : public:
     735              :   /* A support class for uniquifying instances of symbolic_region.  */
     736              :   struct key_t
     737              :   {
     738        75824 :     key_t (const region *parent, const svalue *sval_ptr)
     739        75824 :     : m_parent (parent), m_sval_ptr (sval_ptr)
     740              :     {
     741        75824 :       gcc_assert (sval_ptr);
     742              :     }
     743              : 
     744       453276 :     hashval_t hash () const
     745              :     {
     746       453276 :       inchash::hash hstate;
     747       453276 :       hstate.add_ptr (m_parent);
     748       453276 :       hstate.add_ptr (m_sval_ptr);
     749       453276 :       return hstate.end ();
     750              :     }
     751              : 
     752       430244 :     bool operator== (const key_t &other) const
     753              :     {
     754       430244 :       return (m_parent == other.m_parent && m_sval_ptr == other.m_sval_ptr);
     755              :     }
     756              : 
     757              :     void mark_deleted () { m_sval_ptr = reinterpret_cast<const svalue *> (1); }
     758            0 :     void mark_empty () { m_sval_ptr = nullptr; }
     759       486652 :     bool is_deleted () const
     760              :     {
     761       486652 :       return m_sval_ptr == reinterpret_cast<const svalue *> (1);
     762              :     }
     763      1705506 :     bool is_empty () const { return m_sval_ptr == nullptr; }
     764              : 
     765              :     const region *m_parent;
     766              :     const svalue *m_sval_ptr;
     767              :   };
     768              : 
     769              :   symbolic_region (symbolic::node::id_t id, region *parent, const svalue *sval_ptr);
     770              : 
     771              :   const symbolic_region *
     772      3104430 :   dyn_cast_symbolic_region () const final override { return this; }
     773              : 
     774      8493377 :   enum region_kind get_kind () const final override { return RK_SYMBOLIC; }
     775              :   void accept (visitor *v) const final override;
     776              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     777              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     778              :   void
     779              :   add_dump_widget_children_for_region (text_art::tree_widget &w,
     780              :                             symbolic::node_dump_state &nds)
     781              :     const final override;
     782              :   void
     783              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     784              : 
     785              :   std::unique_ptr<json::object>
     786              :   to_json () const final override;
     787              : 
     788              :   std::unique_ptr<diagnostics::markup::node>
     789              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     790              : 
     791      3239512 :   const svalue *get_pointer () const { return m_sval_ptr; }
     792              : 
     793              : private:
     794              :   const svalue *m_sval_ptr;
     795              : };
     796              : 
     797              : } // namespace ana
     798              : 
     799              : template <>
     800              : template <>
     801              : inline bool
     802       135082 : is_a_helper <const symbolic_region *>::test (const region *reg)
     803              : {
     804       135082 :   return reg->get_kind () == RK_SYMBOLIC;
     805              : }
     806              : 
     807              : template <> struct default_hash_traits<symbolic_region::key_t>
     808              : : public member_function_hash_traits<symbolic_region::key_t>
     809              : {
     810              :   static const bool empty_zero_p = true;
     811              : };
     812              : 
     813              : namespace ana {
     814              : 
     815              : /* Concrete region subclass representing the memory occupied by a
     816              :    variable (whether for a global or a local).
     817              :    Also used for representing SSA names, as if they were locals.  */
     818              : 
     819              : class decl_region : public region
     820              : {
     821              : public:
     822       128186 :   decl_region (symbolic::node::id_t id, const region *parent, tree decl)
     823       384558 :   : region (complexity (parent), id, parent, TREE_TYPE (decl)), m_decl (decl),
     824       256372 :     m_tracked (calc_tracked_p (decl)),
     825       128186 :     m_ctor_bit_contents (nullptr)
     826       128186 :   {}
     827              : 
     828     30641869 :   enum region_kind get_kind () const final override { return RK_DECL; }
     829              :   const decl_region *
     830      5351887 :   dyn_cast_decl_region () const final override { return this; }
     831              : 
     832              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     833              : 
     834              :   void
     835              :   print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     836              : 
     837              :   void
     838              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     839              : 
     840              :   std::unique_ptr<json::object>
     841              :   to_json () const final override;
     842              : 
     843              :   std::unique_ptr<diagnostics::markup::node>
     844              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     845              : 
     846      1357516 :   bool tracked_p () const final override { return m_tracked; }
     847              : 
     848      4118952 :   tree get_decl () const { return m_decl; }
     849              :   int get_stack_depth () const;
     850              : 
     851              :   const symbolic::bit_contents *
     852              :   maybe_get_bit_contents_for_initializer (region_model_manager *mgr) const;
     853              : 
     854              :   const svalue *maybe_get_constant_value (region_model_manager *mgr) const;
     855              :   const svalue *get_svalue_for_constructor (tree ctor,
     856              :                                             region_model_manager *mgr) const;
     857              :   const symbolic::bit_contents &
     858              :   get_bit_contents_for_constructor (tree ctor,
     859              :                                     region_model_manager *mgr) const;
     860              :   const svalue *get_svalue_for_initializer (region_model_manager *mgr) const;
     861              : 
     862              :   const symbolic::bit_vector *
     863              :   maybe_get_bit_vector_for_initializer (symbolic::node_manager &node_mgr) const;
     864              : 
     865              : private:
     866              :   const symbolic::bit_contents &
     867              :   calc_bit_contents_for_constructor (tree ctor,
     868              :                                      region_model_manager *mgr) const;
     869              :   static bool calc_tracked_p (tree decl);
     870              : 
     871              :   tree m_decl;
     872              : 
     873              :   /* Cached result of calc_tracked_p, so that we can quickly determine when
     874              :      we don't to track a binding_cluster for this decl (to avoid bloating
     875              :      store objects).
     876              :      This can be debugged using -fdump-analyzer-untracked.  */
     877              :   bool m_tracked;
     878              : 
     879              :   /* Cached result of get_bit_contents_for_constructor.  */
     880              :   mutable const symbolic::bit_contents *m_ctor_bit_contents;
     881              : };
     882              : 
     883              : } // namespace ana
     884              : 
     885              : template <>
     886              : template <>
     887              : inline bool
     888       818863 : is_a_helper <const decl_region *>::test (const region *reg)
     889              : {
     890       818863 :   return reg->get_kind () == RK_DECL;
     891              : }
     892              : 
     893              : namespace ana {
     894              : 
     895              : /* Concrete region subclass representing the memory occupied by a
     896              :    field within a struct or union.  */
     897              : 
     898              : class field_region : public region
     899              : {
     900              : public:
     901              :   /* A support class for uniquifying instances of field_region.  */
     902              :   struct key_t
     903              :   {
     904        87551 :     key_t (const region *parent, tree field)
     905        87551 :     : m_parent (parent), m_field (field)
     906              :     {
     907        87551 :       gcc_assert (field);
     908              :     }
     909              : 
     910       571266 :     hashval_t hash () const
     911              :     {
     912       571266 :       inchash::hash hstate;
     913       571266 :       hstate.add_ptr (m_parent);
     914       571266 :       hstate.add_ptr (m_field);
     915       571266 :       return hstate.end ();
     916              :     }
     917              : 
     918       566004 :     bool operator== (const key_t &other) const
     919              :     {
     920       566004 :       return (m_parent == other.m_parent && m_field == other.m_field);
     921              :     }
     922              : 
     923              :     void mark_deleted () { m_field = reinterpret_cast<tree> (1); }
     924            0 :     void mark_empty () { m_field = NULL_TREE; }
     925       635935 :     bool is_deleted () const { return m_field == reinterpret_cast<tree> (1); }
     926      2111772 :     bool is_empty () const { return m_field == NULL_TREE; }
     927              : 
     928              :     const region *m_parent;
     929              :     tree m_field;
     930              :   };
     931              : 
     932        13364 :   field_region (symbolic::node::id_t id, const region *parent, tree field)
     933        26728 :   : region (complexity (parent), id, parent, TREE_TYPE (field)),
     934        13364 :     m_field (field)
     935        13364 :   {}
     936              : 
     937        54863 :   enum region_kind get_kind () const final override { return RK_FIELD; }
     938              : 
     939              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
     940              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
     941              : 
     942              :   void
     943              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
     944              : 
     945              :   std::unique_ptr<json::object>
     946              :   to_json () const final override;
     947              : 
     948              :   std::unique_ptr<diagnostics::markup::node>
     949              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
     950              : 
     951              :   const field_region *
     952            0 :   dyn_cast_field_region () const final override { return this; }
     953              : 
     954         1991 :   tree get_field () const { return m_field; }
     955              : 
     956              :   const symbolic_bit_count *
     957              :   maybe_get_bit_offset_relative_to_parent (region_model_manager &mgr)
     958              :     const final override;
     959              : 
     960              :   const symbolic_byte_count *
     961              :   maybe_get_byte_offset_relative_to_parent (region_model_manager &mgr)
     962              :     const final override;
     963              : 
     964              : private:
     965              :   tree m_field;
     966              : };
     967              : 
     968              : } // namespace ana
     969              : 
     970              : template <>
     971              : template <>
     972              : inline bool
     973         2004 : is_a_helper <const field_region *>::test (const region *reg)
     974              : {
     975         2004 :   return reg->get_kind () == RK_FIELD;
     976              : }
     977              : 
     978              : template <> struct default_hash_traits<field_region::key_t>
     979              : : public member_function_hash_traits<field_region::key_t>
     980              : {
     981              :   static const bool empty_zero_p = true;
     982              : };
     983              : 
     984              : namespace ana {
     985              : 
     986              : /* An element within an array.  */
     987              : 
     988              : class element_region : public region
     989              : {
     990              : public:
     991              :   /* A support class for uniquifying instances of element_region.  */
     992              :   struct key_t
     993              :   {
     994        29711 :     key_t (const region *parent, tree element_type, const svalue *index)
     995        29711 :     : m_parent (parent), m_element_type (element_type), m_index (index)
     996              :     {
     997        29711 :       gcc_assert (index);
     998              :     }
     999              : 
    1000       182291 :     hashval_t hash () const
    1001              :     {
    1002       182291 :       inchash::hash hstate;
    1003       182291 :       hstate.add_ptr (m_parent);
    1004       182291 :       hstate.add_ptr (m_element_type);
    1005       182291 :       hstate.add_ptr (m_index);
    1006       182291 :       return hstate.end ();
    1007              :     }
    1008              : 
    1009       173755 :     bool operator== (const key_t &other) const
    1010              :     {
    1011       173755 :       return (m_parent == other.m_parent
    1012        71740 :               && m_element_type == other.m_element_type
    1013       245495 :               && m_index == other.m_index);
    1014              :     }
    1015              : 
    1016              :     void mark_deleted () { m_index = reinterpret_cast<const svalue *> (1); }
    1017            0 :     void mark_empty () { m_index = nullptr; }
    1018       202006 :     bool is_deleted () const
    1019              :     {
    1020       202006 :       return m_index == reinterpret_cast<const svalue *> (1);
    1021              :     }
    1022       800222 :     bool is_empty () const { return m_index == nullptr; }
    1023              : 
    1024              :     const region *m_parent;
    1025              :     tree m_element_type;
    1026              :     const svalue *m_index;
    1027              :   };
    1028              : 
    1029         6347 :   element_region (symbolic::node::id_t id, const region *parent, tree element_type,
    1030              :                   const svalue *index)
    1031         6347 :   : region (complexity::from_pair (parent, index), id, parent, element_type),
    1032        12694 :     m_index (index)
    1033         6347 :   {}
    1034              : 
    1035        20551 :   enum region_kind get_kind () const final override { return RK_ELEMENT; }
    1036              :   const element_region *
    1037            0 :   dyn_cast_element_region () const final override { return this; }
    1038              : 
    1039              :   void accept (visitor *v) const final override;
    1040              : 
    1041              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1042              : 
    1043              :   void
    1044              :   print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1045              :   void
    1046              :   add_dump_widget_children_for_region (text_art::tree_widget &,
    1047              :                             symbolic::node_dump_state &nds)
    1048              :     const final override;
    1049              : 
    1050              :   void
    1051              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1052              : 
    1053              :   std::unique_ptr<json::object>
    1054              :   to_json () const final override;
    1055              : 
    1056              :   std::unique_ptr<diagnostics::markup::node>
    1057              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1058              : 
    1059        10513 :   const svalue *get_index () const { return m_index; }
    1060              : 
    1061              :   const symbolic_bit_count *
    1062              :   maybe_get_bit_offset_relative_to_parent (region_model_manager &mgr)
    1063              :     const final override;
    1064              : 
    1065              :   const symbolic_byte_count *
    1066              :   maybe_get_byte_offset_relative_to_parent (region_model_manager &mgr)
    1067              :     const final override;
    1068              : 
    1069              : private:
    1070              :   const svalue *m_index;
    1071              : };
    1072              : 
    1073              : } // namespace ana
    1074              : 
    1075              : template <>
    1076              : template <>
    1077              : inline bool
    1078          225 : is_a_helper <const element_region *>::test (const region *reg)
    1079              : {
    1080          225 :   return reg->get_kind () == RK_ELEMENT;
    1081              : }
    1082              : 
    1083              : template <> struct default_hash_traits<element_region::key_t>
    1084              : : public member_function_hash_traits<element_region::key_t>
    1085              : {
    1086              :   static const bool empty_zero_p = true;
    1087              : };
    1088              : 
    1089              : namespace ana {
    1090              : 
    1091              : /* A byte-offset within another region, for handling pointer arithmetic
    1092              :    as a region.  */
    1093              : 
    1094              : class offset_region : public region
    1095              : {
    1096              : public:
    1097              :   /* A support class for uniquifying instances of offset_region.  */
    1098              :   struct key_t
    1099              :   {
    1100        32216 :     key_t (const region *parent, tree element_type, const svalue *byte_offset)
    1101        32216 :     : m_parent (parent), m_element_type (element_type), m_byte_offset (byte_offset)
    1102              :     {
    1103        32216 :       gcc_assert (byte_offset);
    1104              :     }
    1105              : 
    1106       211606 :     hashval_t hash () const
    1107              :     {
    1108       211606 :       inchash::hash hstate;
    1109       211606 :       hstate.add_ptr (m_parent);
    1110       211606 :       hstate.add_ptr (m_element_type);
    1111       211606 :       hstate.add_ptr (m_byte_offset);
    1112       211606 :       return hstate.end ();
    1113              :     }
    1114              : 
    1115       205173 :     bool operator== (const key_t &other) const
    1116              :     {
    1117       205173 :       return (m_parent == other.m_parent
    1118        72192 :               && m_element_type == other.m_element_type
    1119       265344 :               && m_byte_offset == other.m_byte_offset);
    1120              :     }
    1121              : 
    1122              :     void mark_deleted () { m_byte_offset = reinterpret_cast<const svalue *> (1); }
    1123            0 :     void mark_empty () { m_byte_offset = nullptr; }
    1124       234101 :     bool is_deleted () const
    1125              :     {
    1126       234101 :       return m_byte_offset == reinterpret_cast<const svalue *> (1);
    1127              :     }
    1128       872116 :     bool is_empty () const { return m_byte_offset == nullptr; }
    1129              : 
    1130              :     const region *m_parent;
    1131              :     tree m_element_type;
    1132              :     const svalue *m_byte_offset;
    1133              :   };
    1134              : 
    1135         6552 :   offset_region (symbolic::node::id_t id, const region *parent, tree type,
    1136              :                  const svalue *byte_offset)
    1137         6552 :   : region (complexity::from_pair (parent, byte_offset), id, parent, type),
    1138        13104 :     m_byte_offset (byte_offset)
    1139         6552 :   {}
    1140              : 
    1141        22519 :   enum region_kind get_kind () const final override { return RK_OFFSET; }
    1142              :   const offset_region *
    1143          215 :   dyn_cast_offset_region () const final override { return this; }
    1144              : 
    1145              :   void accept (visitor *v) const final override;
    1146              : 
    1147              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1148              : 
    1149              :   void
    1150              :   print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1151              :   void
    1152              :   add_dump_widget_children_for_region (text_art::tree_widget &,
    1153              :                             symbolic::node_dump_state &nds)
    1154              :     const final override;
    1155              : 
    1156              :   void
    1157              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1158              : 
    1159              :   std::unique_ptr<json::object>
    1160              :   to_json () const final override;
    1161              : 
    1162              :   std::unique_ptr<diagnostics::markup::node>
    1163              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1164              : 
    1165        11069 :   const svalue *get_byte_offset () const { return m_byte_offset; }
    1166              :   const svalue *get_bit_offset (region_model_manager *mgr) const;
    1167              : 
    1168              :   const symbolic_bit_count *
    1169              :   maybe_get_bit_offset_relative_to_parent (region_model_manager &mgr)
    1170              :     const final override;
    1171              : 
    1172              :   const symbolic_byte_count *
    1173              :   maybe_get_byte_offset_relative_to_parent (region_model_manager &mgr)
    1174              :     const final override;
    1175              : 
    1176              : private:
    1177              :   const svalue *m_byte_offset;
    1178              : };
    1179              : 
    1180              : } // namespace ana
    1181              : 
    1182              : template <>
    1183              : template <>
    1184              : inline bool
    1185            0 : is_a_helper <const offset_region *>::test (const region *reg)
    1186              : {
    1187            0 :   return reg->get_kind () == RK_OFFSET;
    1188              : }
    1189              : 
    1190              : template <> struct default_hash_traits<offset_region::key_t>
    1191              : : public member_function_hash_traits<offset_region::key_t>
    1192              : {
    1193              :   static const bool empty_zero_p = true;
    1194              : };
    1195              : 
    1196              : namespace ana {
    1197              : 
    1198              : /* A region that is size BYTES_SIZE_SVAL in size within its parent
    1199              :    region (or possibly larger, which would lead to an overflow.  */
    1200              : 
    1201              : class sized_region : public region
    1202              : {
    1203              : public:
    1204              :   /* A support class for uniquifying instances of sized_region.  */
    1205              :   struct key_t
    1206              :   {
    1207        35977 :     key_t (const region *parent, tree element_type,
    1208              :            const svalue *byte_size_sval)
    1209        35977 :       : m_parent (parent), m_element_type (element_type),
    1210        35977 :         m_byte_size_sval (byte_size_sval)
    1211              :     {
    1212        35977 :       gcc_assert (byte_size_sval);
    1213              :     }
    1214              : 
    1215       253989 :     hashval_t hash () const
    1216              :     {
    1217       253989 :       inchash::hash hstate;
    1218       253989 :       hstate.add_ptr (m_parent);
    1219       253989 :       hstate.add_ptr (m_element_type);
    1220       253989 :       hstate.add_ptr (m_byte_size_sval);
    1221       253989 :       return hstate.end ();
    1222              :     }
    1223              : 
    1224       245630 :     bool operator== (const key_t &other) const
    1225              :     {
    1226       245630 :       return (m_parent == other.m_parent
    1227        31979 :               && m_element_type == other.m_element_type
    1228       274543 :               && m_byte_size_sval == other.m_byte_size_sval);
    1229              :     }
    1230              : 
    1231              :     void mark_deleted () { m_byte_size_sval = reinterpret_cast<const svalue *> (1); }
    1232            0 :     void mark_empty () { m_byte_size_sval = nullptr; }
    1233       285057 :     bool is_deleted () const
    1234              :     {
    1235       285057 :       return m_byte_size_sval == reinterpret_cast<const svalue *> (1);
    1236              :     }
    1237      1044712 :     bool is_empty () const { return m_byte_size_sval == nullptr; }
    1238              : 
    1239              :     const region *m_parent;
    1240              :     tree m_element_type;
    1241              :     const svalue *m_byte_size_sval;
    1242              :     const svalue *m_end_offset;
    1243              :   };
    1244              : 
    1245        10300 :   sized_region (symbolic::node::id_t id, const region *parent, tree type,
    1246              :                 const svalue *byte_size_sval)
    1247        10300 :   : region (complexity::from_pair (parent, byte_size_sval),
    1248              :             id, parent, type),
    1249        20600 :     m_byte_size_sval (byte_size_sval)
    1250        10300 :   {}
    1251              : 
    1252        29709 :   enum region_kind get_kind () const final override { return RK_SIZED; }
    1253              :   const sized_region *
    1254            0 :   dyn_cast_sized_region () const final override { return this; }
    1255              : 
    1256              :   void accept (visitor *v) const final override;
    1257              : 
    1258              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1259              :   void
    1260              :   print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1261              :   void
    1262              :   add_dump_widget_children_for_region (text_art::tree_widget &,
    1263              :                                        symbolic::node_dump_state &nds)
    1264              :     const final override;
    1265              : 
    1266              :   void
    1267              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1268              : 
    1269              :   std::unique_ptr<json::object>
    1270              :   to_json () const final override;
    1271              : 
    1272              :   std::unique_ptr<diagnostics::markup::node>
    1273              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1274              : 
    1275              :   const symbolic_byte_size *
    1276              :   maybe_get_byte_size (symbolic::scalar_manager<concrete_byte_size> &byte_mgr) const final override;
    1277              :   const symbolic_bit_size *
    1278              :   maybe_get_bit_size (symbolic::scalar_manager<concrete_bit_size> &bit_mgr) const final override;
    1279              : 
    1280              : private:
    1281              :   const svalue *m_byte_size_sval;
    1282              : };
    1283              : 
    1284              : } // namespace ana
    1285              : 
    1286              : template <>
    1287              : template <>
    1288              : inline bool
    1289            0 : is_a_helper <const sized_region *>::test (const region *reg)
    1290              : {
    1291            0 :   return reg->get_kind () == RK_SIZED;
    1292              : }
    1293              : 
    1294              : template <> struct default_hash_traits<sized_region::key_t>
    1295              : : public member_function_hash_traits<sized_region::key_t>
    1296              : {
    1297              :   static const bool empty_zero_p = true;
    1298              : };
    1299              : 
    1300              : namespace ana {
    1301              : 
    1302              : /* A region that views another region using a different type.  */
    1303              : 
    1304              : class cast_region : public region
    1305              : {
    1306              : public:
    1307              :   /* A support class for uniquifying instances of cast_region.  */
    1308              :   struct key_t
    1309              :   {
    1310        29239 :     key_t (const region *parent, tree type)
    1311        29239 :     : m_parent (parent), m_type (type)
    1312              :     {
    1313        29239 :       gcc_assert (parent);
    1314              :     }
    1315              : 
    1316       165396 :     hashval_t hash () const
    1317              :     {
    1318       165396 :       inchash::hash hstate;
    1319       165396 :       hstate.add_ptr (m_parent);
    1320       165396 :       hstate.add_ptr (m_type);
    1321       165396 :       return hstate.end ();
    1322              :     }
    1323              : 
    1324       152022 :     bool operator== (const key_t &other) const
    1325              :     {
    1326       152022 :       return (m_parent == other.m_parent
    1327       152022 :               && m_type == other.m_type);
    1328              :     }
    1329              : 
    1330              :     void mark_deleted ()
    1331              :     {
    1332              :       m_parent = reinterpret_cast<const region *> (1);
    1333              :     }
    1334            0 :     void mark_empty () { m_parent = nullptr; }
    1335       183315 :     bool is_deleted () const
    1336              :     {
    1337       183315 :       return m_parent == reinterpret_cast<const region *> (1);
    1338              :     }
    1339       768707 :     bool is_empty () const { return m_parent == nullptr; }
    1340              : 
    1341              :     const region *m_parent;
    1342              :     tree m_type;
    1343              :   };
    1344              : 
    1345         5878 :   cast_region (symbolic::node::id_t id, const region *parent, tree type)
    1346         5878 :   : region (complexity (parent), id,
    1347         5878 :             parent, type)
    1348         5878 :   {}
    1349              : 
    1350        14944 :   enum region_kind get_kind () const final override { return RK_CAST; }
    1351              :   const cast_region *
    1352           34 :   dyn_cast_cast_region () const final override { return this; }
    1353              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1354              :   void
    1355              :   print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1356              : 
    1357              :   void
    1358              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1359              : 
    1360              :   std::unique_ptr<json::object>
    1361              :   to_json () const final override;
    1362              : 
    1363              :   std::unique_ptr<diagnostics::markup::node>
    1364              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1365              : 
    1366              :   const symbolic_bit_count *
    1367              :   maybe_get_bit_offset_relative_to_parent (region_model_manager &mgr)
    1368              :     const final override;
    1369              : 
    1370              :   const symbolic_byte_count *
    1371              :   maybe_get_byte_offset_relative_to_parent (region_model_manager &mgr)
    1372              :     const final override;
    1373              : };
    1374              : 
    1375              : } // namespace ana
    1376              : 
    1377              : template <>
    1378              : template <>
    1379              : inline bool
    1380              : is_a_helper <const cast_region *>::test (const region *reg)
    1381              : {
    1382              :   return reg->get_kind () == RK_CAST;
    1383              : }
    1384              : 
    1385              : template <> struct default_hash_traits<cast_region::key_t>
    1386              : : public member_function_hash_traits<cast_region::key_t>
    1387              : {
    1388              :   static const bool empty_zero_p = true;
    1389              : };
    1390              : 
    1391              : namespace ana {
    1392              : 
    1393              : /* An untyped region dynamically allocated on the heap via "malloc"
    1394              :    or similar.  */
    1395              : 
    1396              : class heap_allocated_region : public region
    1397              : {
    1398              : public:
    1399         1813 :   heap_allocated_region (symbolic::node::id_t id, const region *parent)
    1400         1813 :   : region (complexity (parent), id, parent, NULL_TREE)
    1401         1813 :   {}
    1402              : 
    1403              :   enum region_kind
    1404      3604158 :   get_kind () const final override { return RK_HEAP_ALLOCATED; }
    1405              : 
    1406              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1407              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1408              : 
    1409              :   void
    1410              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1411              : 
    1412              :   std::unique_ptr<json::object>
    1413              :   to_json () const final override;
    1414              : 
    1415              :   std::unique_ptr<diagnostics::markup::node>
    1416              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1417              : };
    1418              : 
    1419              : /* An untyped region dynamically allocated on the stack via "alloca".  */
    1420              : 
    1421              : class alloca_region : public region
    1422              : {
    1423              : public:
    1424         1128 :   alloca_region (symbolic::node::id_t id, const frame_region *parent)
    1425         1128 :   : region (complexity (parent), id, parent, NULL_TREE)
    1426         1128 :   {}
    1427              : 
    1428       276975 :   enum region_kind get_kind () const final override { return RK_ALLOCA; }
    1429              : 
    1430              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1431              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1432              : 
    1433              :   void
    1434              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1435              : 
    1436              :   std::unique_ptr<json::object>
    1437              :   to_json () const final override;
    1438              : 
    1439              :   std::unique_ptr<diagnostics::markup::node>
    1440              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1441              : };
    1442              : 
    1443              : /* A region for a STRING_CST.  */
    1444              : 
    1445              : class string_region : public region
    1446              : {
    1447              : public:
    1448         3912 :   string_region (symbolic::node::id_t id, const region *parent, tree string_cst)
    1449         7824 :   : region (complexity (parent), id, parent, TREE_TYPE (string_cst)),
    1450         3912 :     m_string_cst (string_cst)
    1451         3912 :   {}
    1452              : 
    1453              :   const string_region *
    1454         1680 :   dyn_cast_string_region () const final override { return this; }
    1455              : 
    1456       186129 :   enum region_kind get_kind () const final override { return RK_STRING; }
    1457              : 
    1458              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1459              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1460              :   void
    1461              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1462              : 
    1463              :   std::unique_ptr<json::object>
    1464              :   to_json () const final override;
    1465              : 
    1466              :   std::unique_ptr<diagnostics::markup::node>
    1467              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1468              : 
    1469              :   /* We assume string literals are immutable, so we don't track them in
    1470              :      the store.  */
    1471          596 :   bool tracked_p () const final override { return false; }
    1472              : 
    1473         8375 :   tree get_string_cst () const { return m_string_cst; }
    1474              : 
    1475              : private:
    1476              :   tree m_string_cst;
    1477              : };
    1478              : 
    1479              : } // namespace ana
    1480              : 
    1481              : template <>
    1482              : template <>
    1483              : inline bool
    1484         6336 : is_a_helper <const string_region *>::test (const region *reg)
    1485              : {
    1486         6336 :   return reg->get_kind () == RK_STRING;
    1487              : }
    1488              : 
    1489              : namespace ana {
    1490              : 
    1491              : /* A region for a specific range of bits within another region.  */
    1492              : 
    1493              : class bit_range_region : public region
    1494              : {
    1495              : public:
    1496              :   /* A support class for uniquifying instances of bit_range_region.  */
    1497       168370 :   struct key_t
    1498              :   {
    1499          920 :     key_t (const region *parent, tree type, const concrete_bit_range &bits)
    1500          920 :     : m_parent (parent), m_type (type), m_bits (bits)
    1501              :     {
    1502          920 :       gcc_assert (parent);
    1503          920 :     }
    1504              : 
    1505         7221 :     hashval_t hash () const
    1506              :     {
    1507         7221 :       inchash::hash hstate;
    1508         7221 :       hstate.add_ptr (m_parent);
    1509         7221 :       hstate.add_ptr (m_type);
    1510         7221 :       hstate.add_int (m_bits.get_start_offset ().as_long ());
    1511         7221 :       hstate.add_int (m_bits.get_size ().as_long ());
    1512         7221 :       return hstate.end ();
    1513              :     }
    1514              : 
    1515         6465 :     bool operator== (const key_t &other) const
    1516              :     {
    1517         6465 :       return (m_parent == other.m_parent
    1518         1364 :               && m_type == other.m_type
    1519         7829 :               && m_bits == other.m_bits);
    1520              :     }
    1521              : 
    1522              :     void mark_deleted () { m_parent = reinterpret_cast<const region *> (1); }
    1523            0 :     void mark_empty () { m_parent = nullptr; }
    1524         8410 :     bool is_deleted () const
    1525              :     {
    1526         8410 :       return m_parent == reinterpret_cast<const region *> (1);
    1527              :     }
    1528       142675 :     bool is_empty () const { return m_parent == nullptr; }
    1529              : 
    1530              :     const region *m_parent;
    1531              :     tree m_type;
    1532              :     concrete_bit_range m_bits;
    1533              :   };
    1534              : 
    1535          451 :   bit_range_region (symbolic::node::id_t id, const region *parent, tree type,
    1536              :                     const concrete_bit_range &bits)
    1537          451 :   : region (complexity (parent), id, parent, type),
    1538          451 :     m_bits (bits)
    1539          451 :   {}
    1540              : 
    1541              :   const bit_range_region *
    1542            0 :   dyn_cast_bit_range_region () const final override { return this; }
    1543              : 
    1544          662 :   enum region_kind get_kind () const final override { return RK_BIT_RANGE; }
    1545              : 
    1546              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1547              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1548              :   void
    1549              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1550              : 
    1551              :   std::unique_ptr<json::object>
    1552              :   to_json () const final override;
    1553              : 
    1554              :   std::unique_ptr<diagnostics::markup::node>
    1555              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1556              : 
    1557            0 :   const concrete_bit_range &get_bits () const { return m_bits; }
    1558              : 
    1559              :   const symbolic_byte_size *
    1560              :   maybe_get_byte_size (symbolic::scalar_manager<concrete_byte_size> &byte_mgr)
    1561              :     const final override;
    1562              : 
    1563              :   const symbolic_bit_size *
    1564              :   maybe_get_bit_size (symbolic::scalar_manager<concrete_bit_size> &bit_mgr)
    1565              :     const final override;
    1566              : 
    1567              :   const symbolic_bit_count *
    1568              :   maybe_get_bit_offset_relative_to_parent (region_model_manager &mgr)
    1569              :     const final override;
    1570              : 
    1571              :   const symbolic_byte_count *
    1572              :   maybe_get_byte_offset_relative_to_parent (region_model_manager &mgr)
    1573              :     const final override;
    1574              : 
    1575              : private:
    1576              :   concrete_bit_range m_bits;
    1577              : };
    1578              : 
    1579              : } // namespace ana
    1580              : 
    1581              : template <>
    1582              : template <>
    1583              : inline bool
    1584            0 : is_a_helper <const bit_range_region *>::test (const region *reg)
    1585              : {
    1586            0 :   return reg->get_kind () == RK_BIT_RANGE;
    1587              : }
    1588              : 
    1589              : template <> struct default_hash_traits<bit_range_region::key_t>
    1590              : : public member_function_hash_traits<bit_range_region::key_t>
    1591              : {
    1592              :   static const bool empty_zero_p = true;
    1593              : };
    1594              : 
    1595              : namespace ana {
    1596              : 
    1597              : /* A region for the N-th vararg within a frame_region for a variadic call.  */
    1598              : 
    1599              : class var_arg_region : public region
    1600              : {
    1601              : public:
    1602              :   /* A support class for uniquifying instances of var_arg_region.  */
    1603              :   struct key_t
    1604              :   {
    1605         1310 :     key_t (const frame_region *parent, unsigned idx)
    1606         1310 :     : m_parent (parent), m_idx (idx)
    1607              :     {
    1608         1310 :       gcc_assert (parent);
    1609              :     }
    1610              : 
    1611         9161 :     hashval_t hash () const
    1612              :     {
    1613         9161 :       inchash::hash hstate;
    1614         9161 :       hstate.add_ptr (m_parent);
    1615         9161 :       hstate.add_int (m_idx);
    1616         9161 :       return hstate.end ();
    1617              :     }
    1618              : 
    1619         8426 :     bool operator== (const key_t &other) const
    1620              :     {
    1621         8426 :       return (m_parent == other.m_parent
    1622         8426 :               && m_idx == other.m_idx);
    1623              :     }
    1624              : 
    1625              :     void mark_deleted ()
    1626              :     {
    1627              :       m_parent = reinterpret_cast<const frame_region *> (1);
    1628              :     }
    1629            0 :     void mark_empty () { m_parent = nullptr; }
    1630        10167 :     bool is_deleted () const
    1631              :     {
    1632        10167 :       return m_parent == reinterpret_cast<const frame_region *> (1);
    1633              :     }
    1634       150103 :     bool is_empty () const { return m_parent == nullptr; }
    1635              : 
    1636              :     const frame_region *m_parent;
    1637              :     unsigned m_idx;
    1638              :   };
    1639              : 
    1640          495 :   var_arg_region (symbolic::node::id_t id, const frame_region *parent,
    1641              :                   unsigned idx)
    1642          495 :   : region (complexity (parent), id, parent, NULL_TREE),
    1643          495 :     m_idx (idx)
    1644          495 :   {}
    1645              : 
    1646              :   const var_arg_region *
    1647          583 :   dyn_cast_var_arg_region () const final override { return this; }
    1648              : 
    1649       161539 :   enum region_kind get_kind () const final override { return RK_VAR_ARG; }
    1650              : 
    1651              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1652              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1653              :   void
    1654              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1655              : 
    1656              :   std::unique_ptr<json::object>
    1657              :   to_json () const final override;
    1658              : 
    1659              :   std::unique_ptr<diagnostics::markup::node>
    1660              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1661              : 
    1662              :   const frame_region *get_frame_region () const;
    1663          703 :   unsigned get_index () const { return m_idx; }
    1664              : 
    1665              : private:
    1666              :   unsigned m_idx;
    1667              : };
    1668              : 
    1669              : } // namespace ana
    1670              : 
    1671              : template <>
    1672              : template <>
    1673              : inline bool
    1674              : is_a_helper <const var_arg_region *>::test (const region *reg)
    1675              : {
    1676              :   return reg->get_kind () == RK_VAR_ARG;
    1677              : }
    1678              : 
    1679              : template <> struct default_hash_traits<var_arg_region::key_t>
    1680              : : public member_function_hash_traits<var_arg_region::key_t>
    1681              : {
    1682              :   static const bool empty_zero_p = true;
    1683              : };
    1684              : 
    1685              : namespace ana {
    1686              : 
    1687              : /* A region for errno for the current thread.  */
    1688              : 
    1689         4409 : class errno_region : public region
    1690              : {
    1691              : public:
    1692         4409 :   errno_region (symbolic::node::id_t id, const thread_local_region *parent)
    1693         4409 :   : region (complexity (parent), id, parent, integer_type_node)
    1694         4409 :   {}
    1695              : 
    1696       209664 :   enum region_kind get_kind () const final override { return RK_ERRNO; }
    1697              : 
    1698              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1699              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1700              :   void
    1701              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1702              : 
    1703              :   std::unique_ptr<json::object>
    1704              :   to_json () const final override;
    1705              : 
    1706              :   std::unique_ptr<diagnostics::markup::node>
    1707              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1708              : };
    1709              : 
    1710              : } // namespace ana
    1711              : 
    1712              : template <>
    1713              : template <>
    1714              : inline bool
    1715              : is_a_helper <const errno_region *>::test (const region *reg)
    1716              : {
    1717              :   return reg->get_kind () == RK_ERRNO;
    1718              : }
    1719              : 
    1720              : namespace ana {
    1721              : 
    1722              : /* Similar to a decl region, but we don't have the decl.
    1723              :    For implementing e.g. static buffers of known_functions,
    1724              :    or other internal state of an API.
    1725              : 
    1726              :    These are owned by known_function instances, rather than the
    1727              :    region_model_manager.  */
    1728              : 
    1729              : class private_region : public region
    1730              : {
    1731              : public:
    1732         7146 :   private_region (unsigned id, const region *parent, tree type,
    1733              :                   const char *desc)
    1734         7146 :   : region (complexity (parent), id, parent, type),
    1735         7146 :     m_desc (desc)
    1736         7146 :   {}
    1737              : 
    1738        13616 :   enum region_kind get_kind () const final override { return RK_PRIVATE; }
    1739              : 
    1740              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1741              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1742              :   void
    1743              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1744              : 
    1745              :   std::unique_ptr<json::object>
    1746              :   to_json () const final override;
    1747              : 
    1748              :   std::unique_ptr<diagnostics::markup::node>
    1749              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1750              : 
    1751              : private:
    1752              :   const char *m_desc;
    1753              : };
    1754              : 
    1755              : } // namespace ana
    1756              : 
    1757              : template <>
    1758              : template <>
    1759              : inline bool
    1760              : is_a_helper <const private_region *>::test (const region *reg)
    1761              : {
    1762              :   return reg->get_kind () == RK_PRIVATE;
    1763              : }
    1764              : 
    1765              : namespace ana {
    1766              : 
    1767              : /* An unknown region, for handling unimplemented tree codes.  */
    1768              : 
    1769              : class unknown_region : public region
    1770              : {
    1771              : public:
    1772          122 :   unknown_region (symbolic::node::id_t id, const region *parent, tree type)
    1773          122 :   : region (complexity (parent), id, parent, type)
    1774          122 :   {}
    1775              : 
    1776         1622 :   enum region_kind get_kind () const final override { return RK_UNKNOWN; }
    1777              : 
    1778              :   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
    1779              :   void print_region_for_dump_widget_label (pretty_printer *pp) const final override;
    1780              :   void
    1781              :   accept_node_visitor (symbolic::node_visitor &v) const final override;
    1782              : 
    1783              :   std::unique_ptr<json::object>
    1784              :   to_json () const final override;
    1785              : 
    1786              :   std::unique_ptr<diagnostics::markup::node>
    1787              :   make_markup_node (symbolic::markup_context &markup_ctxt) const final override;
    1788              : };
    1789              : 
    1790              : } // namespace ana
    1791              : 
    1792              : #endif /* GCC_ANALYZER_REGION_H */
        

Generated by: LCOV version 2.5.0-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.