* [committed] Fix handling of DECL_IN_CONSTANT_POOL in OpenMP gimplification (PR middle-end/91920)
@ 2019-09-27 20:16 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2019-09-27 20:16 UTC (permalink / raw)
To: gcc-patches
Hi!
The DECL_IN_CONSTANT_POOL variables are artificial vars that need to be
predetermined shared, they aren't user visible and user has no control about
those. In C/C++, we predetermine artificial variables shared, but only if
they have integral types.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk, queued for backporting.
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.
--- gcc/gimplify.c.jj 2019-09-20 12:25:46.829408105 +0200
+++ 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)
{
--- gcc/testsuite/c-c++-common/gomp/pr91920.c.jj 2019-09-27 11:57:26.066813061 +0200
+++ 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);
+}
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-27 20:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 20:16 [committed] Fix handling of DECL_IN_CONSTANT_POOL in OpenMP gimplification (PR middle-end/91920) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).