[cfe-commits] r112943 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGen/_Bool-conversion.c

Daniel Dunbar daniel at zuster.org
Thu Sep 2 19:07:01 PDT 2010


Author: ddunbar
Date: Thu Sep  2 21:07:00 2010
New Revision: 112943

URL: http://llvm.org/viewvc/llvm-project?rev=112943&view=rev
Log:
IRgen: Fix silly thinko in r112021, which was generating code for the same expr
twice. This showed up as an assert on the odd test case because we generated the
decl map entry twice.

Modified:
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
    cfe/trunk/test/CodeGen/_Bool-conversion.c

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=112943&r1=112942&r2=112943&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Thu Sep  2 21:07:00 2010
@@ -1033,7 +1033,7 @@
 
     // Handle conversion to bool correctly.
     if (DestTy->isBooleanType())
-      return EmitScalarConversion(Visit(E), E->getType(), DestTy);
+      return EmitScalarConversion(Src, E->getType(), DestTy);
 
     return Builder.CreatePtrToInt(Src, ConvertType(DestTy));
   }

Modified: cfe/trunk/test/CodeGen/_Bool-conversion.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/_Bool-conversion.c?rev=112943&r1=112942&r2=112943&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/_Bool-conversion.c (original)
+++ cfe/trunk/test/CodeGen/_Bool-conversion.c Thu Sep  2 21:07:00 2010
@@ -6,3 +6,7 @@
 
 static _Bool f0_0(void *a0) { return (_Bool) a0; }
 int f0() { return f0_0((void*) 0x2); }
+
+_Bool f1(void) {
+  return (_Bool) ({ void (*x)(); x = 0; });
+}





More information about the cfe-commits mailing list