PR tree-optimization/45463 (cgraph verification ICE)

H.J. Lu hjl.tools@gmail.com
Sun Oct 24 16:45:00 GMT 2010


On Thu, Sep 16, 2010 at 2:22 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> the testcase shows situation where virtual function is inlined and contains
> recursive call. Inline the function makes it possible to devirtualize the
> call, but since we already eliminated the COMDAT function as unnecesary
> we mess up representing the direct call.
>
> This shows broader problem that COMDAT and EXTERN virtual methods whose vtables
> live in other unit are eliminated too early so we don't have chance to devirtualize
> them.
>
> This patch makes us to hold all those function until inlining when all devirtualization
> that matter should be already done.
>
> Bootstrapped/regtested x86_64-linux, will commit it shortly (with the testcase)
>
> struct S
> {
>  S();
>  virtual inline void foo ()
>  {
>    foo();
>  }
> };
>
> void
> B ()
> {
>  S().foo ();
> }
>
>        * cgraphunit.c (cgraph_finalize_function): Consider comdat & external
>        virtual functions are reachable.
>        * ipa-inline.c (cgraph_clone_inlined_nodes): Likewise.
>        * ipa.c (cgraph_remove_unreachable_nodes): Likewise.
>        * ipa-prop.c (ipa_modify_formal_parameters): Clear DECL_VIRTUAL_P
>        when modifying function.

This caused:

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


H.J.



More information about the Gcc-patches mailing list