[cfe-commits] r44993 - in /cfe/trunk: Sema/SemaExpr.cpp test/Sema/shift.c

Chris Lattner sabre at nondot.org
Wed Dec 12 23:28:16 PST 2007


Author: lattner
Date: Thu Dec 13 01:28:16 2007
New Revision: 44993

URL: http://llvm.org/viewvc/llvm-project?rev=44993&view=rev
Log:
Don't do integer promotions of LHS for compound shift assignment.  The LHS has to be a modifiable lvalue.

Added:
    cfe/trunk/test/Sema/shift.c
Modified:
    cfe/trunk/Sema/SemaExpr.cpp

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

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Thu Dec 13 01:28:16 2007
@@ -1321,7 +1321,8 @@
   
   // Shifts don't perform usual arithmetic conversions, they just do integer
   // promotions on each operand. C99 6.5.7p3
-  UsualUnaryConversions(lex);
+  if (!isCompAssign)
+    UsualUnaryConversions(lex);
   UsualUnaryConversions(rex);
   
   // "The type of the result is that of the promoted left operand."

Added: cfe/trunk/test/Sema/shift.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/shift.c?rev=44993&view=auto

==============================================================================
--- cfe/trunk/test/Sema/shift.c (added)
+++ cfe/trunk/test/Sema/shift.c Thu Dec 13 01:28:16 2007
@@ -0,0 +1,6 @@
+// RUN: clang -fsyntax-only %s
+
+void test() {
+  char c;
+  c <<= 14;
+}





More information about the cfe-commits mailing list