1 /* { dg-options "-O2 -msoft-stack" } */
2 /* { dg-do run } */
3
4 static __attribute__((noinline,noclone)) int f(int *p)
5 {
6 return __sync_lock_test_and_set(p, 1);
7 }
8
9 static __attribute__((noinline,noclone)) int g(int n)
10 {
11 /* Check that variable-length stack allocation works. */
12 int v[n];
13 v[0] = 0;
14 /* Check that atomic operations can be applied to auto data. */
15 return f(v) == 0 && v[0] == 1;
16 }
17
18 int main()
19 {
20 if (!g(1))
21 __builtin_abort();
22 return 0;
23 }