[cfe-commits] r71640 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/types.c

Chris Lattner sabre at nondot.org
Tue May 12 22:13:45 PDT 2009


Author: lattner
Date: Wed May 13 00:13:44 2009
New Revision: 71640

URL: http://llvm.org/viewvc/llvm-project?rev=71640&view=rev
Log:
Fix rdar://6880951 by rejecting vectors of vectors.
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.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/Sema/types.c

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=71640&r1=71639&r2=71640&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed May 13 00:13:44 2009
@@ -221,8 +221,9 @@
      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;
   }

Modified: cfe/trunk/test/Sema/types.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/types.c?rev=71640&r1=71639&r2=71640&view=diff

==============================================================================
--- cfe/trunk/test/Sema/types.c (original)
+++ cfe/trunk/test/Sema/types.c Wed May 13 00:13:44 2009
@@ -34,3 +34,6 @@
 // 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}}





More information about the cfe-commits mailing list