This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70847] [6/7 Regression] exponential time in cp_fold for chained virtual function calls


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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu.org

--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> ---
This seems to be related to cp_fold_r's behavior to walk subtree for
OBJ_TYPE_REF.
Normally we can assume that in case of an OBJ_TYPE_REF tree, it was already
folded.  So we don't need to walk it again .

The following patch solves the issue for me on m32c.

Index: ../gcc/cp/cp-gimplify.c
===================================================================
--- ../gcc/cp/cp-gimplify.c     (revision 235430)
+++ ../gcc/cp/cp-gimplify.c     (working copy)
@@ -986,7 +986,8 @@
       cp_walk_tree (&OMP_FOR_PRE_BODY (stmt), cp_fold_r, data, NULL);
       *walk_subtrees = 0;
     }
-
+  else if (code == OBJ_TYPE_REF)
+    *walk_subtrees = 0;
   return NULL;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]