From b8910447230acb4d7651f131174cee296e4ac66d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 23 Jan 2015 19:19:50 +0100 Subject: [PATCH] re PR middle-end/64734 (ICE at omp lowering) PR middle-end/64734 * omp-low.c (scan_sharing_clauses): Don't ignore OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION GOMP_MAP_POINTER clauses on target data/update constructs. * libgomp.c/pr64734.c: New test. From-SVN: r220053 --- gcc/ChangeLog | 7 ++++ gcc/omp-low.c | 3 +- libgomp/ChangeLog | 5 +++ libgomp/testsuite/libgomp.c/pr64734.c | 55 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 libgomp/testsuite/libgomp.c/pr64734.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e4a4cf0641f..e5eaf5b6026 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-01-23 Jakub Jelinek + + PR middle-end/64734 + * omp-low.c (scan_sharing_clauses): Don't ignore + OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION GOMP_MAP_POINTER clauses + on target data/update constructs. + 2015-01-23 Bernd Edlinger PR target/50928 diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 15893109889..da53334b325 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1834,7 +1834,8 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) /* Ignore GOMP_MAP_POINTER kind for arrays in regions that are not offloaded; there is nothing to map for those. */ if (!is_gimple_omp_offloaded (ctx->stmt) - && !POINTER_TYPE_P (TREE_TYPE (decl))) + && !POINTER_TYPE_P (TREE_TYPE (decl)) + && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)) break; } if (DECL_P (decl)) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index b6dfa23d3cc..b58d1c6cdaf 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2015-01-23 Jakub Jelinek + + PR middle-end/64734 + * libgomp.c/pr64734.c: New test. + 2015-01-23 Tom de Vries PR libgomp/64672 diff --git a/libgomp/testsuite/libgomp.c/pr64734.c b/libgomp/testsuite/libgomp.c/pr64734.c new file mode 100644 index 00000000000..457f481ae0b --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr64734.c @@ -0,0 +1,55 @@ +/* PR middle-end/64734 */ + +#include + +void +foo (int *x, int *y) +{ + #pragma omp target map (alloc:x[0]) map (alloc:y[0:8]) + { + int i; + for (i = 0; i < 8; i++) + if (y[i] != 2 + i) + break; + if (i != 8 || *x != 1) + *x = 6; + else + { + *x = 8; + for (i = 0; i < 8; i++) + y[i] = 9 + i; + } + } + #pragma omp target update from (y[0:8]) from (x[0]) +} + +void +bar (void) +{ + int x = 1, y[32] = { 0 }; + #pragma omp target data map (to:y[0:32]) map (to:x) + ; +} + +int +main () +{ + int x = 1, y[8] = { 2, 3, 4, 5, 6, 7, 8, 9 }, i; + #pragma omp target data map (to:y[0:8]) map (to:x) + ; + #pragma omp target data map (to:y[0:8]) map (to:x) + { + #pragma omp target update from (y[0:8]) from (x) + } + + #pragma omp target data map (to:y[0:8]) map (to:x) + foo (&x, &y[0]); + + if (x != 8) + abort (); + for (i = 0; i < 8; i++) + if (y[i] != 9 + i) + abort (); + + return 0; +} -- 2.30.2