c++: crash with anon VAR_DECL [PR116676]
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / pr60823-2.c
blobe402b5ab06b35ba8dae19f496a0620f7ccb55858
1 /* PR tree-optimization/60823 */
2 /* { dg-do run } */
3 /* { dg-require-effective-target vect_simd_clones } */
4 /* { dg-options "-O2 -fopenmp-simd" } */
6 #ifdef __aarch64__
7 #pragma omp declare simd simdlen(2) notinbranch
8 #else
9 #pragma omp declare simd simdlen(4) notinbranch
10 #endif
11 __attribute__((noinline)) int
12 foo (double c1, double c2)
14 double z1 = c1, z2 = c2;
15 int res = 100, i;
17 for (i = 0; i < 5; i++)
19 res = (z1 * z1 + z2 * z2 > 4.0) ? (i < res ? i : res) : res;
20 z1 = c1 + z1 * z1 - z2 * z2;
21 z2 = c2 + 2.0 * z1 * z2;
22 c1 += 0.5;
23 c2 += 0.5;
25 return res;
28 __attribute__((noinline, noclone)) void
29 bar (double *x, double *y)
31 asm volatile ("" : : "rm" (x), "rm" (y) : "memory");
34 int
35 main ()
37 int i;
38 double c[4] = { 0.0, 1.0, 0.0, 1.0 };
39 double d[4] = { 0.0, 1.0, 2.0, 0.0 };
40 int e[4];
41 bar (c, d);
42 #pragma omp simd safelen(4)
43 for (i = 0; i < 4; i++)
44 e[i] = foo (c[i], d[i]);
45 if (e[0] != 3 || e[1] != 1 || e[2] != 1 || e[3] != 2)
46 __builtin_abort ();
47 return 0;