re PR middle-end/63247 (fortran array alignment in omp target map)
authorJakub Jelinek <jakub@redhat.com>
Mon, 29 Sep 2014 05:20:52 +0000 (07:20 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 29 Sep 2014 05:20:52 +0000 (07:20 +0200)
PR middle-end/63247
* omp-low.c (lower_omp_target): For OMP_CLAUSE_MAP_POINTER
of ARRAY_TYPE, if not OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION
use the alignment of avar rather than ovar.

From-SVN: r215678

gcc/ChangeLog
gcc/omp-low.c

index 8628256afb8ebf5a310d83be031af4654d93d6da..bf450917a8c8813d83b46c0bb2809b466afb1ec9 100644 (file)
@@ -1,3 +1,10 @@
+2014-09-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/63247
+       * omp-low.c (lower_omp_target): For OMP_CLAUSE_MAP_POINTER
+       of ARRAY_TYPE, if not OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION
+       use the alignment of avar rather than ovar.
+
 2014-09-28  John David Anglin  <danglin@gcc.gnu.org>
 
        * config/pa/pa.c (pa_output_function_epilogue): Only update
index 82651eae7bb99a1ae2090750fbb7b9c4ad287db6..eb0a7ee2fe3bcd358d6e091c9ff308cd0b7336da 100644 (file)
@@ -10117,6 +10117,9 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
                  continue;
              }
 
+           unsigned int talign = TYPE_ALIGN_UNIT (TREE_TYPE (ovar));
+           if (DECL_P (ovar) && DECL_ALIGN_UNIT (ovar) > talign)
+             talign = DECL_ALIGN_UNIT (ovar);
            if (nc)
              {
                tree var = lookup_decl_in_outer_ctx (ovar, ctx);
@@ -10131,6 +10134,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
                      = create_tmp_var (TREE_TYPE (TREE_TYPE (x)), NULL);
                    mark_addressable (avar);
                    gimplify_assign (avar, build_fold_addr_expr (var), &ilist);
+                   talign = DECL_ALIGN_UNIT (avar);
                    avar = build_fold_addr_expr (avar);
                    gimplify_assign (x, avar, &ilist);
                  }
@@ -10183,9 +10187,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
              default:
                gcc_unreachable ();
              }
-           unsigned int talign = TYPE_ALIGN_UNIT (TREE_TYPE (ovar));
-           if (DECL_P (ovar) && DECL_ALIGN_UNIT (ovar) > talign)
-             talign = DECL_ALIGN_UNIT (ovar);
            talign = ceil_log2 (talign);
            tkind |= talign << 3;
            CONSTRUCTOR_APPEND_ELT (vkind, purpose,