]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c/68960 (__attribute__ ((aligned ())) is ignored for OpenMP private...
authorJakub Jelinek <jakub@redhat.com>
Thu, 11 Feb 2016 09:13:42 +0000 (10:13 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 11 Feb 2016 09:13:42 +0000 (10:13 +0100)
Backported from mainline
2016-01-07  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/68960
* gimple-expr.c (copy_var_decl): If var has DECL_USER_ALIGN set, copy
it and DECL_ALIGN too.

* testsuite/libgomp.c/pr68960.c: New test.

From-SVN: r233327

gcc/ChangeLog
gcc/gimple-expr.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c/pr68960.c [new file with mode: 0644]

index 7f4438cf3889d44863c67821bb7982a76750b71b..5ac9db343a7890b7ddaa294c31af0fdea5290fb4 100644 (file)
@@ -1,6 +1,12 @@
 2016-02-11  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-01-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/68960
+       * gimple-expr.c (copy_var_decl): If var has DECL_USER_ALIGN set, copy
+       it and DECL_ALIGN too.
+
        2016-01-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/69015
index da663d6fb79908fce3d4d4669a232545712eac7a..8ee5fa4530dfd87bd70cc5c17e45449f2091f570 100644 (file)
@@ -374,6 +374,11 @@ copy_var_decl (tree var, tree name, tree type)
   TREE_USED (copy) = 1;
   DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
   DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var);
+  if (DECL_USER_ALIGN (var))
+    {
+      DECL_ALIGN (copy) = DECL_ALIGN (var);
+      DECL_USER_ALIGN (copy) = 1;
+    }
 
   return copy;
 }
index e4c9c7712d5f9e404548c2958d6c43de71d928df..1c8d0e6ed40a904d14cacb9cde811d6298ad54b2 100644 (file)
@@ -1,3 +1,11 @@
+2016-02-11  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2016-01-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/68960
+       * testsuite/libgomp.c/pr68960.c: New test.
+
 2016-01-26  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/69110
diff --git a/libgomp/testsuite/libgomp.c/pr68960.c b/libgomp/testsuite/libgomp.c/pr68960.c
new file mode 100644 (file)
index 0000000..2accc6a
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR middle-end/68960 */
+/* { dg-do run } */
+
+int
+main ()
+{
+  int temp[257] __attribute__ ((aligned (256))) = { 0 };
+  #pragma omp parallel private (temp) num_threads (2)
+  {
+    int *p = &temp[0];
+    asm volatile ("" : "+g" (p));
+    if (((__UINTPTR_TYPE__) p) & 255)
+      __builtin_abort ();
+  }
+  #pragma omp parallel num_threads (2)
+  #pragma omp single
+  #pragma omp task firstprivate (temp)
+  {
+    int *p = &temp[0];
+    asm volatile ("" : "+g" (p));
+    if (((__UINTPTR_TYPE__) p) & 255)
+      __builtin_abort ();
+  }
+  return 0;
+}