aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index b252345..76e9096 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5199,6 +5199,18 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
+ if (vecsize % tree_low_cst (TYPE_SIZE_UNIT (type), 1))
+ {
+ error ("vector size not an integral multiple of component size");
+ return NULL;
+ }
+
+ if (vecsize == 0)
+ {
+ error ("zero vector size");
+ return NULL;
+ }
+
/* Calculate how many units fit in the vector. */
nunits = vecsize / tree_low_cst (TYPE_SIZE_UNIT (type), 1);
if (nunits & (nunits - 1))