[cfe-commits] r98400 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Sema/overloadable.c

John McCall rjmccall at apple.com
Fri Mar 12 15:14:13 PST 2010


Author: rjmccall
Date: Fri Mar 12 17:14:13 2010
New Revision: 98400

URL: http://llvm.org/viewvc/llvm-project?rev=98400&view=rev
Log:
Check compatibility of vector types using their canonicalizations.
Fixes an assertion arising C overload analysis, but really I can't imagine
that this wouldn't cause a thousand other uncaught failures.

Fixes PR6600.


Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/Sema/overloadable.c

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=98400&r1=98399&r2=98400&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Mar 12 17:14:13 2010
@@ -4736,7 +4736,8 @@
     return QualType();
   case Type::Vector:
     // FIXME: The merged type should be an ExtVector!
-    if (areCompatVectorTypes(LHS->getAs<VectorType>(), RHS->getAs<VectorType>()))
+    if (areCompatVectorTypes(LHSCan->getAs<VectorType>(),
+                             RHSCan->getAs<VectorType>()))
       return LHS;
     return QualType();
   case Type::ObjCInterface: {

Modified: cfe/trunk/test/Sema/overloadable.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/overloadable.c?rev=98400&r1=98399&r2=98400&view=diff
==============================================================================
--- cfe/trunk/test/Sema/overloadable.c (original)
+++ cfe/trunk/test/Sema/overloadable.c Fri Mar 12 17:14:13 2010
@@ -50,4 +50,13 @@
   promote(sp); // expected-error{{call to unavailable function 'promote'}}
 }
 
-
+// PR6600
+typedef double Double;
+typedef Double DoubleVec __attribute__((vector_size(16)));
+typedef int Int;
+typedef Int IntVec __attribute__((vector_size(16)));
+double magnitude(DoubleVec) __attribute__((__overloadable__));
+double magnitude(IntVec) __attribute__((__overloadable__));
+double test_p6600(DoubleVec d) {
+  return magnitude(d) * magnitude(d);
+}





More information about the cfe-commits mailing list