[Bug c++/70847] [6/7 Regression] exponential time in cp_fold for chained virtual function calls
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jun 3 12:15:00 GMT 2016
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.
More information about the Gcc-bugs
mailing list