Mercurial > hg > CbC > CbC_gcc
diff libgomp/testsuite/libgomp.c/target-9.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgomp/testsuite/libgomp.c/target-9.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -ftree-parallelize-loops=0" } */ +/* { dg-additional-options "-flto" { target lto } } */ + +#include <stdlib.h> + +#define N 123456 + +#pragma omp declare target +int X, Y; +#pragma omp end declare target + +void +foo () +{ + #pragma omp target map(alloc: X) + X = N; +} + +int +main () +{ + int res; + + foo (); + + #pragma omp target map(alloc: X, Y) map(from: res) + { + Y = N; + res = X + Y; + } + + if (res != N + N) + abort (); + + return 0; +}