]> granicus.if.org Git - clang/commitdiff
implement codegen of __imag of a scalar. Our impl doesn't suffer from
authorChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 05:29:21 +0000 (05:29 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 05:29:21 +0000 (05:29 +0000)
GCC bug PR33192.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41427 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGExprScalar.cpp

index 91e76aaf84f682871062ecd7972b10cf061a27e9..9bd5b3f1ccbc678b642e0b9fecda5505e6662ac0 100644 (file)
@@ -393,9 +393,11 @@ Value *ScalarExprEmitter::VisitUnaryImag(const UnaryOperator *E) {
   Expr *Op = E->getSubExpr();
   if (Op->getType()->isComplexType())
     return CGF.EmitComplexExpr(Op).second;
-
-  // FIXME: does this evaluate the subexpr??
-  return 0;  // FIXME:  Return zero of the right int/fp type.
+  
+  // __imag on a scalar returns zero.  Emit it the subexpr to ensure side
+  // effects are evaluated.
+  CGF.EmitScalarExpr(Op);
+  return llvm::Constant::getNullValue(ConvertType(E->getType()));
 }