gcc/
* omp-low.c (scan_sharing_clauses): Disallow dynamic (multidimensional)
arrays within structs.
gcc/testsuite/
* c-c++-common/goacc/deep-copy-multidim.c: Add test.
(cherry picked from openacc-gcc-9-branch commit
857f3bc94d843467db9857b82512a1a5a470b1ef)
+2019-02-05 Julian Brown <julian@codesourcery.com>
+
+ * omp-low.c (scan_sharing_clauses): Disallow dynamic (multidimensional)
+ arrays within structs.
+
2018-10-16 Chung-Lin Tang <cltang@codesourcery.com>
* tree-pretty-print.c (dump_omp_clauses): Add cases for printing
t = TREE_TYPE (t);
}
- install_var_field (da_decl, by_ref, 3, ctx);
+ if (DECL_P (decl))
+ install_var_field (da_decl, by_ref, 3, ctx);
+ else
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "dynamic arrays cannot be used within structs");
+ break;
+ }
+
tree new_var = install_var_local (da_decl, ctx);
bool existed = ctx->dynamic_arrays->put (new_var, da_dimensions);
+2019-02-05 Julian Brown <julian@codesourcery.com>
+
+ * c-c++-common/goacc/deep-copy-multidim.c: Add test.
+
2019-01-31 Julian Brown <julian@codesourcery.com>
* c-c++-common/goacc/deep-copy-arrayofstruct.c: New test.
--- /dev/null
+/* { dg-do compile } */
+
+#include <stdlib.h>
+#include <assert.h>
+
+struct dc
+{
+ int a;
+ int **b;
+};
+
+int
+main ()
+{
+ int n = 100, i, j;
+ struct dc v = { .a = 3 };
+
+ v.b = (int **) malloc (sizeof (int *) * n);
+ for (i = 0; i < n; i++)
+ v.b[i] = (int *) malloc (sizeof (int) * n);
+
+#pragma acc parallel loop copy(v.a, v.b[:n][:n]) /* { dg-error "dynamic arrays cannot be used within structs" } */
+ for (i = 0; i < n; i++)
+ for (j = 0; j < n; j++)
+ v.b[i][j] = v.a + i + j;
+
+ for (i = 0; i < n; i++)
+ for (j = 0; j < n; j++)
+ assert (v.b[i][j] == v.a + i + j);
+
+ return 0;
+}