aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-05-22 20:51:54 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-05-22 20:51:54 +0200
commitc24783c49924474f54feb0c6038cba4719125634 (patch)
treeac190183444200175ba69ab2d6aaf216d6806398 /libgomp/testsuite
parent051e40e0cb151d3fd7a773213ee00f84043e2a25 (diff)
downloadgcc-c24783c49924474f54feb0c6038cba4719125634.zip
gcc-c24783c49924474f54feb0c6038cba4719125634.tar.gz
gcc-c24783c49924474f54feb0c6038cba4719125634.tar.bz2
re PR middle-end/80853 (OpenMP ICE in build_outer_var_ref with array reduction)
PR middle-end/80853 * omp-low.c (lower_reduction_clauses): Pass OMP_CLAUSE_PRIVATE as last argument to build_outer_var_ref for pointer bases of array section reductions. * testsuite/libgomp.c/pr80853.c: New test. From-SVN: r248344
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r--libgomp/testsuite/libgomp.c/pr80853.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/pr80853.c b/libgomp/testsuite/libgomp.c/pr80853.c
new file mode 100644
index 0000000..3c0ff10
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr80853.c
@@ -0,0 +1,29 @@
+/* PR middle-end/80853 */
+/* { dg-do run } */
+
+__attribute__((noinline, noclone)) void
+foo (int *p)
+{
+ #pragma omp for reduction(+:p[:4])
+ for (int i = 0; i < 64; i++)
+ {
+ p[0] += i;
+ p[1] += i / 2;
+ p[2] += 2 * i;
+ p[3] += 3 * i;
+ }
+}
+
+int
+main ()
+{
+ int p[4] = { 0, 0, 0, 0 };
+ #pragma omp parallel
+ foo (p);
+ if (p[0] != 63 * 64 / 2
+ || p[1] != 31 * 32
+ || p[2] != 63 * 64
+ || p[3] != 3 * 63 * 64 / 2)
+ __builtin_abort ();
+ return 0;
+}