#if TEMPL template #else #define T int #endif #if PRIVATE #define firstprivate private #endif struct t { T A; void f() { T B = 49; A = 7; #pragma omp parallel firstprivate(A) if(0) shared(B) default(none) { if (A != 7) __builtin_printf("ERROR 1b: %d (!= 7) inside omp parallel\n", A); A = 5; B = A; } if (A != 7) __builtin_printf("ERROR 1: %d (!= 7) omp parallel\n", A); if (B != 5) __builtin_printf("ERROR 1a: %d\n", B); A = 8; B = 49; #pragma omp parallel firstprivate(A)if(0) shared(B) default(none) { if (A != 8) __builtin_printf("ERROR 1b: %d (!= 8) inside omp parallel\n", A); A = 6; B = A; } if (A != 8) __builtin_printf("ERROR 2: %d (!= 8) omp parallel\n", A); if (B != 6) __builtin_printf("ERROR 2a: %d\n", B); A = 8; B = 49; #pragma omp target firstprivate(A) map(from:B) defaultmap(none) { if (A != 7) __builtin_printf("ERROR 2b: %d (!= 7) inside omp target\n", A); A = 7; B = A; } if (A != 8) __builtin_printf("ERROR 3: %d (!= 8) omp target\n", A); if (B != 7) __builtin_printf("ERROR 3a: %d\n", B); A = 9; B = 49; #pragma omp target firstprivate(A) map(from:B) defaultmap(none) { if (A != 7) __builtin_printf("ERROR 3b: %d (!= 7) inside omp target\n", A); A = 8; B = A; } if (A != 9) __builtin_printf("ERROR 4: %d (!= 9) omp target\n", A); else __builtin_printf("OK\n"); if (B != 8) __builtin_printf("ERROR 4a: %d\n", B); } }; void bar() { #if TEMPL struct t x; #else struct t x; #endif x.f(); } int main() { bar(); }