[Bug c++/70847] New: exponential time in cp_fold for chained virtual function calls

jens.maurer at gmx dot net gcc-bugzilla@gcc.gnu.org
Thu Apr 28 11:48:00 GMT 2016


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

            Bug ID: 70847
           Summary: exponential time in cp_fold for chained virtual
                    function calls
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.maurer at gmx dot net
  Target Milestone: ---

Testcase:

struct D
{
  virtual D& f();
};

void g()
{
  D d;
  d.f().f().f().f().f().f().f().f().f().f().f().f().f().f().f()
#if 1
    .f().f().f().f().f().f().f().f().f().f().f()
#endif
    ;
}

$ time g++ -v -c tst.cxx
gcc version 6.1.0 (GCC)
[does not end]

Changing "#if 1" to "#if 0" yields:

$ time g++ -c output-strip.cxx
real    0m3.341s


"perf top" shows cp_fold, cp_fold_r, cp_walk_subtrees, and walk_tree_1
functions.


More information about the Gcc-bugs mailing list