[cfe-commits] r60058 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/complex.c

Anders Carlsson andersca at mac.com
Tue Nov 25 14:21:48 PST 2008


Author: andersca
Date: Tue Nov 25 16:21:48 2008
New Revision: 60058

URL: http://llvm.org/viewvc/llvm-project?rev=60058&view=rev
Log:
Handle returning complex types that get coerced. Fixes PR3131

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/test/CodeGen/complex.c

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=60058&r1=60057&r2=60058&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Nov 25 16:21:48 2008
@@ -868,7 +868,10 @@
       llvm::PointerType::getUnqual(RetAI.getCoerceToType());
     llvm::Value *V = CreateTempAlloca(ConvertType(RetTy), "tmp");
     Builder.CreateStore(CI, Builder.CreateBitCast(V, CoerceToPTy));
-    return RValue::getAggregate(V);
+    if (RetTy->isAnyComplexType())
+      return RValue::getComplex(LoadComplexFromAddr(V, false));
+    else
+      return RValue::getAggregate(V);
   }
 
   case ABIArgInfo::ByVal:

Modified: cfe/trunk/test/CodeGen/complex.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/complex.c?rev=60058&r1=60057&r2=60058&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/complex.c (original)
+++ cfe/trunk/test/CodeGen/complex.c Tue Nov 25 16:21:48 2008
@@ -51,3 +51,10 @@
   __complex__ long long v = 2;
 }
 
+// PR3131
+float _Complex t4();
+
+void t5() {
+  float _Complex x = t4();
+}
+





More information about the cfe-commits mailing list