summaryrefslogtreecommitdiffstats
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-04 08:07:09 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-04 08:07:09 +0000
commit39cc3e6db49658d78cf2f69b62d8307c6785149a (patch)
tree3cac5cc0fee67f928ce2528c8de83b7102ca5f10 /gcc/c-common.c
parent9338678e8a336a8fb58dbdd27f407cc467a90faa (diff)
downloadppe42-gcc-39cc3e6db49658d78cf2f69b62d8307c6785149a.tar.gz
ppe42-gcc-39cc3e6db49658d78cf2f69b62d8307c6785149a.zip
PR c/25559
* c-common.c (handle_vector_size_attribute): Reject zero vector size as well as sizes not multiple of component size. * gcc.dg/pr25559.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109316 138bc75d-0d04-0410-961f-82ee72b054a4
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 b2523459458..76e90962f9b 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))
OpenPOWER on IntegriCloud