30 lines · c
1// RUN: %libomptarget-compile-run-and-check-generic2// RUN: %libomptarget-compileopt-run-and-check-generic3 4#include <omp.h>5#include <stdio.h>6 7__attribute__((optnone)) void optnone() {}8 9int main() {10 int i = 0;11#pragma omp target teams num_teams(1) map(tofrom : i)12 {13 optnone();14#pragma omp parallel15 if (omp_get_thread_num() == 0)16 ++i;17#pragma omp parallel18 if (omp_get_thread_num() == 0)19 ++i;20#pragma omp parallel21 if (omp_get_thread_num() == 0)22 ++i;23#pragma omp parallel24 if (omp_get_thread_num() == 0)25 ++i;26 }27 // CHECK: 428 printf("%i\n", i);29}30