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