Fix lto/PR60854

Richard Biener richard.guenther@gmail.com
Thu Apr 17 08:00:00 GMT 2014


On Thu, Apr 17, 2014 at 4:30 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> the testcase shows problem where cpp implicit alias is always inline and
> symtab_remove_unreachable_nodes removes the body of aliased function before
> inlininghappens.  The real problem is that cgraph_state is set too early
> and not as the comment says after inlinig, but for release branch I think
> it is easier to sovle the problem by simply making the alias target
> reachable by hand.
>
> Bootstrapped/regtested x86_64-linux, comitted to trunk. Let me know
> when it is OK for release brach.

It's ok for 4.9.1.

Richard.

> Honza
>
> Index: ChangeLog
> ===================================================================
> --- ChangeLog   (revision 209458)
> +++ ChangeLog   (working copy)
> @@ -1,3 +1,9 @@
> +2014-04-16  Jan Hubicka  <hubicka@ucw.cz>
> +
> +       PR ipa/60854
> +       * ipa.c (symtab_remove_unreachable_nodes): Mark targets of
> +       external aliases alive, too.
> +
>  2014-04-16  Andrew  Pinski  <apinski@cavium.com>
>
>         * config/host-linux.c (TRY_EMPTY_VM_SPACE): Change aarch64 ilp32
> Index: testsuite/ChangeLog
> ===================================================================
> --- testsuite/ChangeLog (revision 209450)
> +++ testsuite/ChangeLog (working copy)
> @@ -1,3 +1,8 @@
> +2014-04-16  Jan Hubicka  <hubicka@ucw.cz>
> +
> +       PR ipa/60854
> +       * g++.dg/torture/pr60854.C: New testcase.
> +
>  2014-04-16  Catherine Moore  <clm@codesourcery.com>
>
>         * gcc.target/mips/umips-store16-2.c: New test.
> Index: ipa.c
> ===================================================================
> --- ipa.c       (revision 209450)
> +++ ipa.c       (working copy)
> @@ -415,7 +415,18 @@ symtab_remove_unreachable_nodes (bool be
>                           || !DECL_EXTERNAL (e->callee->decl)
>                           || e->callee->alias
>                           || before_inlining_p))
> -                   pointer_set_insert (reachable, e->callee);
> +                   {
> +                     /* Be sure that we will not optimize out alias target
> +                        body.  */
> +                     if (DECL_EXTERNAL (e->callee->decl)
> +                         && e->callee->alias
> +                         && before_inlining_p)
> +                       {
> +                         pointer_set_insert (reachable,
> +                                             cgraph_function_node (e->callee));
> +                       }
> +                     pointer_set_insert (reachable, e->callee);
> +                   }
>                   enqueue_node (e->callee, &first, reachable);
>                 }
>
> Index: testsuite/g++.dg/torture/pr60854.C
> ===================================================================
> --- testsuite/g++.dg/torture/pr60854.C  (revision 0)
> +++ testsuite/g++.dg/torture/pr60854.C  (revision 0)
> @@ -0,0 +1,13 @@
> +template <typename T>
> +class MyClass
> +{
> +public:
> +  __attribute__ ((__always_inline__)) inline MyClass () { ; }
> +};
> +
> +extern template class MyClass<double>;
> +
> +void Func()
> +{
> +  MyClass<double> x;
> +}



More information about the Gcc-patches mailing list