Hi all,

this simple program currently causes a crash:

typedef bool  bxmm __attribute__ ((vector_size(16)));
typedef float fxmm __attribute__ ((vector_size(16)));

bxmm f(fxmm a, fxmm b) {
    return a < b;
}


The reason for this is, that actually bools are not allowed to be declared as 
gcc-vectors. (At least gcc does not allow this).
The attached patch fixes this issue by emitting an error message when using 
bools in gcc-vectors.

This was tested on current trunk. I guess that current 3.1 branch has the same 
problem but I didn't look it up/tried it.

-- 
Roland

diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 1b95f05..b3b6673 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -3829,7 +3829,7 @@ static void HandleVectorSizeAttr(QualType& CurType, const AttributeList &Attr,
     return;
   }
   // the base type must be integer or float, and can't already be a vector.
-  if (!CurType->isIntegerType() && !CurType->isRealFloatingType()) {
+  if (!CurType->isIntegralType(S.Context) && !CurType->isRealFloatingType()) {
     S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
     Attr.setInvalid();
     return;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to