From 430656e1c392dcd9f17fe91a495421d69fca1bc8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 13 Oct 2009 22:12:09 +0000 Subject: fix test/CodeGen/statements.c on 32-bit hosts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84039 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExprConstant.cpp') diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 119b6f31e4..7f540c3c06 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -548,7 +548,18 @@ public: // Explicit and implicit no-op casts QualType Ty = E->getType(), SubTy = E->getSubExpr()->getType(); if (CGM.getContext().hasSameUnqualifiedType(Ty, SubTy)) - return Visit(E->getSubExpr()); + return Visit(E->getSubExpr()); + + // Handle integer->integer casts for address-of-label differences. + if (Ty->isIntegerType() && SubTy->isIntegerType() && + CGF) { + llvm::Value *Src = Visit(E->getSubExpr()); + if (Src == 0) return 0; + + // Use EmitScalarConversion to perform the conversion. + return cast(CGF->EmitScalarConversion(Src, SubTy, Ty)); + } + return 0; } } -- cgit v1.2.3