[cfe-commits] r79126 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/vector-cast.c

Eli Friedman eli.friedman at gmail.com
Sat Aug 15 12:02:19 PDT 2009


Author: efriedma
Date: Sat Aug 15 14:02:19 2009
New Revision: 79126

URL: http://llvm.org/viewvc/llvm-project?rev=79126&view=rev
Log:
Don't perform integer promotions on the operand to a cast; this 
simplifies the AST, and can matter in some rare cases involving 
casts to vector types. Patch by Enea Zaffanella.


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/Sema/vector-cast.c

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Aug 15 14:02:19 2009
@@ -2992,7 +2992,7 @@
   if (getLangOptions().CPlusPlus)
     return CXXCheckCStyleCast(TyR, castType, castExpr, Kind, FunctionalStyle);
 
-  UsualUnaryConversions(castExpr);
+  DefaultFunctionArrayConversion(castExpr);
 
   // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
   // type needs to be scalar.

Modified: cfe/trunk/test/Sema/vector-cast.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vector-cast.c?rev=79126&r1=79125&r2=79126&view=diff

==============================================================================
--- cfe/trunk/test/Sema/vector-cast.c (original)
+++ cfe/trunk/test/Sema/vector-cast.c Sat Aug 15 14:02:19 2009
@@ -20,7 +20,7 @@
 type 't1' and scalar type 'char *'}}
   v1 = (t1)(long long)10;
   v1 = (t1)(short)10; // -expected-error {{invalid conversion between vector \
-type 't1' and integer type 'int' of different size}}
+type 't1' and integer type 'short' of different size}}
   
   long long r1 = (long long)v1;
   short r2 = (short)v1; // -expected-error {{invalid conversion between vector \





More information about the cfe-commits mailing list