{
if (length == NULL_TREE)
{
- error_at (OMP_CLAUSE_LOCATION (c),
- "for pointer type length expression must be specified");
+ if (C_ARRAY_PARAMETER (ret))
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "for array function parameter length expression "
+ "must be specified");
+ else
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "for pointer type length expression must be specified");
return error_mark_node;
}
if (length != NULL_TREE
{
if (length == NULL_TREE)
{
- error_at (OMP_CLAUSE_LOCATION (c),
- "for pointer type length expression must be specified");
+ if (DECL_ARRAY_PARAMETER_P (ret))
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "for array function parameter length expression "
+ "must be specified");
+ else
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "for pointer type length expression must be specified");
return error_mark_node;
}
if (length != NULL_TREE
;
#pragma omp task depend(out: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
;
- #pragma omp task depend(in: g[:][2:4]) /* { dg-error "for pointer type length expression must be specified" } */
+ #pragma omp task depend(in: g[:][2:4]) /* { dg-error "for array function parameter length expression must be specified" } */
;
#pragma omp task depend(in: h[2:2][-1:]) /* { dg-error "negative low bound in array section" } */
;
bar (e);
#pragma omp target map(to: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
bar (f);
- #pragma omp target map(from: g[:][0:10]) /* { dg-error "for pointer type length expression must be specified" } */
+ #pragma omp target map(from: g[:][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
bar (&g[0][0]);
#pragma omp target map(from: h[2:1][-1:]) /* { dg-error "negative low bound in array section" } */
bar (&h[0][0]);
--- /dev/null
+/* PR c/96678. */
+
+#define SIZE (100)
+typedef double Grid[SIZE];
+
+void test (Grid src1)
+{
+ #pragma omp target map(alloc:src1[:]) /* { dg-error "for array function parameter length expression must be specified" } */
+ {
+ src1[0] = 5;
+ }
+}
+
+void test2 (double src2[])
+{
+ #pragma omp target map(alloc:src2[:]) /* { dg-error "for array function parameter length expression must be specified" } */
+ {
+ src2[0] = 5;
+ }
+}
+
+void test3 (double *src3)
+{
+ #pragma omp target map(alloc:src3[:]) /* { dg-error "for pointer type length expression must be specified" } */
+ {
+ src3[0] = 5;
+ }
+}
+
bar (a);
#pragma omp parallel reduction(+: f[:][0:2]) /* { dg-error "for unknown bound array type length expression must be specified" } */
bar (a);
- #pragma omp parallel reduction(+: a[:][0:10]) /* { dg-error "for pointer type length expression must be specified" } */
+ #pragma omp parallel reduction(+: a[:][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
bar (a);
#pragma omp parallel reduction(+: a[:10][0:12]) /* { dg-error "above array section size" } */
bar (a);
;
#pragma omp task depend(out: f[1:10]) // { dg-error "high bound \[^\n\r]* above array section size" }
;
- #pragma omp task depend(in: g[:][2:4]) // { dg-error "for pointer type length expression must be specified" }
+ #pragma omp task depend(in: g[:][2:4]) // { dg-error "for array function parameter length expression must be specified" }
;
#pragma omp task depend(out: i[:1][11:]) // { dg-error "low bound \[^\n\r]* above array section size" }
;
;
#pragma omp task depend(out: f[1:10]) // { dg-error "high bound \[^\n\r]* above array section size" }
;
- #pragma omp task depend(in: g[:][2:4]) // { dg-error "for pointer type length expression must be specified" }
+ #pragma omp task depend(in: g[:][2:4]) // { dg-error "for array function parameter length expression must be specified" }
;
#pragma omp task depend(in: h[2:2][-1:]) // { dg-error "negative low bound in array section" }
;