This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70847] [6/7 Regression] exponential time in cp_fold for chained virtual function calls
- From: "ktietz at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Apr 2016 14:38:31 +0000
- Subject: [Bug c++/70847] [6/7 Regression] exponential time in cp_fold for chained virtual function calls
- Auto-submitted: auto-generated
- References: <bug-70847-4 at http dot gcc dot gnu dot org/bugzilla/>
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;
}