Properly handle alloca'd OpenACC data mappings
2018-01-31 Cesar Philippidis <cesar@codesourcery.com>
gcc/
* omp-low.c (install_parm_decl): Don't extract identifiers from
artifical decls.
gcc/testsuite/
* c-c++-common/goacc/large_array.c: New test.
@@ -669,7 +669,7 @@ install_parm_decl (tree var, tree type, omp_context *ctx)
tree decl_name = NULL_TREE, t;
location_t loc = UNKNOWN_LOCATION;
- if (DECL_P (var))
+ if (DECL_P (var) && !DECL_ARTIFICIAL (var))
{
decl_name = get_identifier (get_name (var));
loc = DECL_SOURCE_LOCATION (var);
new file mode 100644
@@ -0,0 +1,18 @@
+/* Ensure that alloca'ed arrays can be transferred to the
+ accelerator. */
+
+/* { dg-require-effective-target alloca } */
+
+int
+main ()
+{
+ int n = 100, m = 10, i, j;
+ float a[n][m];
+
+ #pragma acc parallel loop
+ for (i = 0; i < n; i++)
+ for (j = 0; j < m; j++)
+ a[i][j] = 0;
+
+ return 0;
+}