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.

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 ()

Reply via email to