diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-09-03 02:07:00 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-09-03 02:07:00 +0000 |
commit | db50547fd526329d00fa1fee4e7ac90f2624c6e0 (patch) | |
tree | 3dc5fe98e9c3df468825f9826d355d4c0bd84ec5 | |
parent | 52fc314e1b5e1baee6305067cf831763d02bd243 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112943 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 2 | ||||
-rw-r--r-- | test/CodeGen/_Bool-conversion.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index fd77a67606..4e16f66ba4 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1033,7 +1033,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) { // 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)); } diff --git a/test/CodeGen/_Bool-conversion.c b/test/CodeGen/_Bool-conversion.c index fce7ada30a..9e5e894503 100644 --- a/test/CodeGen/_Bool-conversion.c +++ b/test/CodeGen/_Bool-conversion.c @@ -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; }); +} |