]> granicus.if.org Git - clang/commitdiff
Fix rdar://6880951 by rejecting vectors of vectors.
authorChris Lattner <sabre@nondot.org>
Wed, 13 May 2009 05:13:44 +0000 (05:13 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 13 May 2009 05:13:44 +0000 (05:13 +0000)
It seems dubious to me that isIntegerType() returns true for
vectors of integers, but not complex integers.  This should
probably be rethought, I'll file a bugzilla.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71640 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/Sema/types.c

index 6e2cc699a71edf78d21346fd70f61930fb910016..711f5f937fc70fa031cfee9376f5553a23e65cf6 100644 (file)
@@ -221,8 +221,9 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
      canonType->isFunctionType());
      */
   }
-  // the base type must be integer or float.
-  if (!CurType->isIntegerType() && !CurType->isRealFloatingType()) {
+  // the base type must be integer or float, and can't already be a vector.
+  if (CurType->isVectorType() ||
+      (!CurType->isIntegerType() && !CurType->isRealFloatingType())) {
     S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
     return;
   }
index 1232e472eaea52eeaff987edc24fb11ddd830981..e7d4b00a4d2af3b98cea9c6f0afa83e7b7ccb073 100644 (file)
@@ -34,3 +34,6 @@ int j[42];   // expected-error {{redefinition of 'j' with a different type}}
 // rdar://6880104
 _Decimal32 x;  // expected-error {{GNU decimal type extension not supported}}
 
+
+// rdar://6880951
+int __attribute__ ((vector_size (8), vector_size (8))) v;  // expected-error {{invalid vector type}}