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

Richard Guenther rguenther@suse.de
Wed Mar 16 16:50:00 GMT 2011


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.

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;
 }



More information about the Gcc-patches mailing list