https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62092
Bug ID: 62092 Summary: libgomp.c++/target-2.C FAIL while compiling for OpenMP 4.0 offload target Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: iverbin at gmail dot com To reproduce using trunk gcc: g++ -fopenmp libgomp/testsuite/libgomp.c++/target-2.C testsuite/libgomp.c++/target-2-aux.cc GIMPLE after ompexp phase: double fn2(...) { br.21_76 = &b; /* Ok. */ .omp_data_arr.33.br = &br; __builtin_GOMP_target (-1, _Z3fn2iRA1024_dRPd._omp_fn.0, &__OPENMP_TARGET__, 22, &.omp_data_arr.33, &.omp_data_sizes.34, &.omp_data_kinds.35); } _Z3fn2iRA1024_dRPd._omp_fn.0 (struct .omp_data_t.30 * .omp_data_i) { __builtin_GOMP_parallel (_Z3fn2iRA1024_dRPd._omp_fn.1, &.omp_data_o.32, 0, 0); } _Z3fn2iRA1024_dRPd._omp_fn.1 (struct .omp_data_s.31 * .omp_data_i) { br.22_22 = &b; /* Error: trying to use global var b. */ } Reduced testcase is here: https://gcc.gnu.org/ml/gcc/2014-07/msg00076.html