diff mbox

fix guality/nrv-1.c LTO failure

Message ID 53EE6DB5.3090801@gmail.com
State New
Headers show

Commit Message

Aldy Hernandez Aug. 15, 2014, 8:29 p.m. UTC
This test is failing with LTO because in the LTRANS phase (DCE) we 
realize that the call to f() is useless, so we don't generate it.  This 
leads to an uncalled f() which also gets deleted.  We end up with an 
empty main(), and rightly so, gdb has nothing good to print.

Marking `a1' as used keeps things in good enough shape so everyone is happy.

OK for mainline?

     * guality/nrv-1.c: Add `used' attribute to a1.

Comments

Richard Biener Aug. 18, 2014, 10:32 a.m. UTC | #1
On Fri, Aug 15, 2014 at 10:29 PM, Aldy Hernandez <aldyher@gmail.com> wrote:
> This test is failing with LTO because in the LTRANS phase (DCE) we realize
> that the call to f() is useless, so we don't generate it.  This leads to an
> uncalled f() which also gets deleted.  We end up with an empty main(), and
> rightly so, gdb has nothing good to print.
>
> Marking `a1' as used keeps things in good enough shape so everyone is happy.
>
> OK for mainline?

Ok.

Thanks,
Richard.

>     * guality/nrv-1.c: Add `used' attribute to a1.
>
> diff --git a/gcc/testsuite/gcc.dg/guality/nrv-1.c
> b/gcc/testsuite/gcc.dg/guality/nrv-1.c
> index 6e70050..2f4e654 100644
> --- a/gcc/testsuite/gcc.dg/guality/nrv-1.c
> +++ b/gcc/testsuite/gcc.dg/guality/nrv-1.c
> @@ -8,7 +8,7 @@ struct A
>    int i[100];
>  };
>
> -struct A a1, a3;
> +struct A a1 __attribute__((used)), a3;
>
>  __attribute__((noinline)) struct A
>  f ()
>
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/guality/nrv-1.c 
b/gcc/testsuite/gcc.dg/guality/nrv-1.c
index 6e70050..2f4e654 100644
--- a/gcc/testsuite/gcc.dg/guality/nrv-1.c
+++ b/gcc/testsuite/gcc.dg/guality/nrv-1.c
@@ -8,7 +8,7 @@  struct A
    int i[100];
  };

-struct A a1, a3;
+struct A a1 __attribute__((used)), a3;

  __attribute__((noinline)) struct A
  f ()