Commit 81d3b8f7 by Tom de Vries Committed by Tom de Vries

[testsuite/guality] Prevent optimization of local in vla-1.c

2018-07-01  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/prevent-optimization.h (VOLATILE): Define.
	* gcc.dg/guality/vla-1.c (f1): Mark local vla a as VOLATILE.

From-SVN: r262287
parent c2e75518
2018-07-01 Tom de Vries <tdevries@suse.de>
* gcc.dg/guality/prevent-optimization.h (VOLATILE): Define.
* gcc.dg/guality/vla-1.c (f1): Mark local vla a as VOLATILE.
2018-07-01 Tom de Vries <tdevries@suse.de>
* lib/gcc-dg.exp (get-absolute-line): Handle '.'.
* gcc.dg/guality/vla-1.c: Use relative line numbers.
......
......@@ -21,8 +21,10 @@ along with GCC; see the file COPYING3. If not see
#ifdef PREVENT_OPTIMIZATION
#define ATTRIBUTE_USED __attribute__((used))
#define VOLATILE volatile
#else
#define ATTRIBUTE_USED
#define VOLATILE
#endif
#endif
......@@ -2,6 +2,8 @@
/* { dg-do run } */
/* { dg-options "-g" } */
#include "prevent-optimization.h"
void __attribute__((noinline))
bar (short *p)
{
......@@ -12,7 +14,7 @@ bar (short *p)
int __attribute__((noinline))
f1 (int i)
{
char a[i + 1];
VOLATILE char a[i + 1];
a[0] = 5; /* { dg-final { gdb-test .+1 "i" "5" } } */
return a[0]; /* { dg-final { gdb-test . "sizeof (a)" "6" } } */
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment