aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-10-31 20:06:08 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2013-10-31 20:06:08 +0100
commit5a9785fb4c3ceb3b338634f2ea17474eaebb4955 (patch)
treeb855c0f5f2b49779d10067e2ee590fb7d92a9ef8 /gcc/cp
parente5ccdfcd51ccbd0c9353f94f73bce18d42adbaac (diff)
downloadgcc-5a9785fb4c3ceb3b338634f2ea17474eaebb4955.zip
gcc-5a9785fb4c3ceb3b338634f2ea17474eaebb4955.tar.gz
gcc-5a9785fb4c3ceb3b338634f2ea17474eaebb4955.tar.bz2
c-typeck.c (c_finish_omp_clauses): Diagnose aligned clause with decl that is not pointer nor array.
* c-typeck.c (c_finish_omp_clauses): Diagnose aligned clause with decl that is not pointer nor array. * semantics.c (finish_omp_clauses): Diagnose aligned clause with decl that is not pointer nor array nor reference to those. * g++.dg/gomp/simd-1.C: New test. * g++.dg/gomp/declare-simd-1.C (f32): Fix up aligned clause argument. * g++.dg/gomp/declare-simd-2.C (fn13, fn14): Add new tests. * gcc.dg/gomp/declare-simd-2.c (fn7, fn8, fn9, fn10, fn11): Likewise. * c-c++-common/gomp/simd6.c: New test. From-SVN: r204273
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/semantics.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c7a0e5d..e7b1e25 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * semantics.c (finish_omp_clauses): Diagnose aligned clause
+ with decl that is not pointer nor array nor reference to those.
+
2013-10-31 Jason Merrill <jason@redhat.com>
* semantics.c (cxx_eval_call_expression): Handle trivial
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index de3e8e7..49097f7 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5467,6 +5467,19 @@ finish_omp_clauses (tree clauses)
error ("%qE is not a variable in %<aligned%> clause", t);
remove = true;
}
+ else if (!type_dependent_expression_p (t)
+ && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (t)) != ARRAY_TYPE
+ && (TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE
+ || (!POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (t)))
+ && (TREE_CODE (TREE_TYPE (TREE_TYPE (t)))
+ != ARRAY_TYPE))))
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qE in %<aligned%> clause is neither a pointer nor "
+ "an array nor a reference to pointer or array", t);
+ remove = true;
+ }
else if (bitmap_bit_p (&aligned_head, DECL_UID (t)))
{
error ("%qD appears more than once in %<aligned%> clauses", t);