[Bug ipa/60306] [4.9 Regression] Incorrect devirtualization "pure virtual method called"

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 28 20:32:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60306

--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Created attachment 32235
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32235&action=edit
Better WIP patch

Yep, ignoring the calls also surprised me. I spent some time trying to think of
and produce more evil testcases to this issue, but rest of Martin's reasoning
seems right. The code really just mixes up the case where it knows something on
all understood places with the case it knows something on all possible paths
through the code. It implements the first but wants the second.

I also tried to give up on all calls first. That makes the intraprocedural and
part of inter-procedural devirt to give up almost always. Except for trivial
cases that are handled by SCCVN you almost always have a call in a way, so
testsuite is not really happy about it.

Other option is to simply give up on recording anything when type change is
seen. This also fixes the bug, perhaps with less fallout.

Third option is to record if walk ever reached top of function and if it did
give up when type change is seen. This seems to be simple addition to ao
walker, we just need some interface for it.

Fourth option is to be smarter about the calls defining type that is something
I would like to do for next stage1, patch attached. It is ortoghonal to 1/2/3,
if we have it we will just understand more paths (and currently I punt if I see
some not understood path)

I can get some data on difference in between options 1,2,3 for mainline, or do
we just want to give up?



More information about the Gcc-bugs mailing list