[cfe-commits] r96958 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp test/CodeGen/cast-emit.c
Eli Friedman
eli.friedman at gmail.com
Tue Feb 23 09:58:36 PST 2010
Author: efriedma
Date: Tue Feb 23 11:58:35 2010
New Revision: 96958
URL: http://llvm.org/viewvc/llvm-project?rev=96958&view=rev
Log:
PR6386: Fix a recent regression in IRGen of cast-to-union constructs.
Added:
cfe/trunk/test/CodeGen/cast-emit.c
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=96958&r1=96957&r2=96958&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Tue Feb 23 11:58:35 2010
@@ -189,7 +189,7 @@
CGF.ConvertType(PtrTy));
EmitInitializationToLValue(E->getSubExpr(),
LValue::MakeAddr(CastPtr, Qualifiers()),
- E->getType());
+ E->getSubExpr()->getType());
break;
}
Added: cfe/trunk/test/CodeGen/cast-emit.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/cast-emit.c?rev=96958&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/cast-emit.c (added)
+++ cfe/trunk/test/CodeGen/cast-emit.c Tue Feb 23 11:58:35 2010
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+typedef union {
+ int i;
+ float f;
+} MyUnion;
+void unionf(MyUnion a);
+void uniontest(float a) {
+ f((MyUnion)1.0f);
+// CHECK: store float 1.000000e+00
+}
+
More information about the cfe-commits
mailing list