From: Tom de Vries Date: Sun, 1 Jul 2018 15:54:48 +0000 (+0000) Subject: [testsuite/guality] Prevent optimization of local in vla-1.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81d3b8f7029f8790211628e308a766783193a8ef;p=gcc.git [testsuite/guality] Prevent optimization of local in vla-1.c 2018-07-01 Tom de Vries * gcc.dg/guality/prevent-optimization.h (VOLATILE): Define. * gcc.dg/guality/vla-1.c (f1): Mark local vla a as VOLATILE. From-SVN: r262287 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d24b0b4e430..b8b00f5f875 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-07-01 Tom de Vries + + * 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 * lib/gcc-dg.exp (get-absolute-line): Handle '.'. diff --git a/gcc/testsuite/gcc.dg/guality/prevent-optimization.h b/gcc/testsuite/gcc.dg/guality/prevent-optimization.h index 0ef84a3d9c8..57e945cafb4 100644 --- a/gcc/testsuite/gcc.dg/guality/prevent-optimization.h +++ b/gcc/testsuite/gcc.dg/guality/prevent-optimization.h @@ -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 diff --git a/gcc/testsuite/gcc.dg/guality/vla-1.c b/gcc/testsuite/gcc.dg/guality/vla-1.c index 264b9f3f92b..d281185c18c 100644 --- a/gcc/testsuite/gcc.dg/guality/vla-1.c +++ b/gcc/testsuite/gcc.dg/guality/vla-1.c @@ -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" } } */ }