pmaports/cross/gcc-aarch64/gcc10-pr91920.patch

42 lines
1.2 KiB
Diff
Raw Normal View History

2019-11-25 08:49:29 +00:00
2019-09-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/91920
* gimplify.c (omp_default_clause): Predetermine DECL_IN_CONSTANT_POOL
variables as shared.
* c-c++-common/gomp/pr91920.c: New test.
--- a/gcc/gimplify.c.jj 2019-09-20 12:25:46.829408105 +0200
+++ b/gcc/gimplify.c 2019-09-27 11:52:17.458446652 +0200
@@ -7132,6 +7132,8 @@ omp_default_clause (struct gimplify_omp_
kind = lang_hooks.decls.omp_predetermined_sharing (decl);
if (kind != OMP_CLAUSE_DEFAULT_UNSPECIFIED)
default_kind = kind;
+ else if (VAR_P (decl) && TREE_STATIC (decl) && DECL_IN_CONSTANT_POOL (decl))
+ default_kind = OMP_CLAUSE_DEFAULT_SHARED;
switch (default_kind)
{
--- a/gcc/testsuite/c-c++-common/gomp/pr91920.c.jj 2019-09-27 11:57:26.066813061 +0200
+++ b/gcc/testsuite/c-c++-common/gomp/pr91920.c 2019-09-27 11:57:08.931070237 +0200
@@ -0,0 +1,19 @@
+/* PR middle-end/91920 */
+
+void bar (float *);
+
+void
+foo (void)
+{
+ int i;
+ float f[3] = { 0.0f, 0.0f, 0.0f };
+#pragma omp parallel for default(none) reduction(+:f[:3])
+ for (i = 0; i < 1000; i++)
+ {
+ int j;
+ float k[3] = { 0.25f, 0.5f, 0.75f };
+ for (j = 0; j < 3; j++)
+ f[j] += k[j];
+ }
+ bar (f);
+}