[cfe-commits] r142863 - in /cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGenCXX/const-init.cpp
Eli Friedman
eli.friedman at gmail.com
Mon Oct 24 15:25:55 PDT 2011
Author: efriedma
Date: Mon Oct 24 17:25:55 2011
New Revision: 142863
URL: http://llvm.org/viewvc/llvm-project?rev=142863&view=rev
Log:
Don't try to emit CK_LValueBitCast casts as constants. PR9558.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGenCXX/const-init.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=142863&r1=142862&r2=142863&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Mon Oct 24 17:25:55 2011
@@ -573,7 +573,6 @@
case CK_CPointerToObjCPointerCast:
case CK_BlockPointerToObjCPointerCast:
case CK_AnyPointerToBlockPointerCast:
- case CK_LValueBitCast:
case CK_BitCast:
if (C->getType() == destType) return C;
return llvm::ConstantExpr::getBitCast(C, destType);
@@ -589,6 +588,7 @@
case CK_ARCConsumeObject:
case CK_ARCReclaimReturnedObject:
case CK_ARCExtendBlockObject:
+ case CK_LValueBitCast:
return 0;
// These might need to be supported for constexpr.
Modified: cfe/trunk/test/CodeGenCXX/const-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/const-init.cpp?rev=142863&r1=142862&r2=142863&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/const-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/const-init.cpp Mon Oct 24 17:25:55 2011
@@ -36,3 +36,7 @@
double t0 = A::d;
double t1[] = { A::d, A::f };
}
+
+// We don't expect to fold this in the frontend, but make sure it doesn't crash.
+// CHECK: @PR9558 = global float 0.000000e+0
+float PR9558 = reinterpret_cast<const float&>("asd");
More information about the cfe-commits
mailing list