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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
This isn't specific to virtual functions; the same slowdown can be seen with

struct BaseType  {
  int i;
};

template< int Seq >
class DerivedType : public DerivedType< Seq - 1 > { };

template<>
class DerivedType< -1 > : public BaseType { };

int main() {
  DerivedType< COUNT > d;
  d.i = 42;
}

The reference to the base member is represented with a long sequence of
COMPONENT_REFs, like
d.derived<5>.derived<4>.derived<3>.derived<2>.derived<1>.derived<0>.derived<-1>.base.i
= 42

and with r10-2823 we check sequence points across each of those .s, with high
algorithmic complexity.  Checking across COMPONENT_REF seems unnecessary, since
it just selects a subobject of the LHS, there's no additional evaluation.
  • [Bug c++/107163] [10/11/12/13 R... jason at gcc dot gnu.org via Gcc-bugs

Reply via email to