diff mbox

Fix parts of gcc.dg/guality/vla-1.c

Message ID alpine.LNX.2.00.1103161748460.25982@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener March 16, 2011, 4:50 p.m. UTC
With -fwhole-program (or -flto) f1 gets promoted to const and the
call to it is optimized away.  The following avoids this by
making use of its return value.

Tested on x86_64-unknown-linux-gnu with and without -fwhole-program,
applied.

Richard.

2011-03-16  Richard Guenther  <rguenther@suse.de>

	* gcc.dg/guality/vla-1.c (main): Use result of f1 to avoid
	optimizing it away if promoted to const.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/guality/vla-1.c
===================================================================
--- gcc/testsuite/gcc.dg/guality/vla-1.c	(revision 171048)
+++ gcc/testsuite/gcc.dg/guality/vla-1.c	(working copy)
@@ -28,9 +28,10 @@  f2 (int i)
 int
 main ()
 {
+  volatile int j;
   int i = 5;
   asm volatile ("" : "=r" (i) : "0" (i));
-  f1 (i);
+  j = f1 (i);
   f2 (i);
   return 0;
 }