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: "ppalka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 03 Jun 2016 12:15:37 +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
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #7)
> Created attachment 38636 [details]
> gcc7-pr70847.patch
>
> Untested fix.
Wouldn't that cause us to fully fold only the first occurrence of a shared tree
and miss folding subsequent occurrences?
If we have a CALL_EXPR whose 1st and 2nd arguments share the same tree
f (x * 0, x * 0);
then IIUC with the patch only the 1st argument would get folded, giving
f (0, x * 0);
Not sure if this is an actual issue in practice, but if it is, it may be
workable by maintaining the pset ourselves in cp_fold_r and doing something
like
if (pset->add (*stmt_p))
*walk_subtrees = 0;
That way *stmt_p will still be set by cp_fold() even when it's a tree that's
alraedy been visited.