[cfe-commits] r147664 - in /cfe/trunk/lib: AST/Expr.cpp CodeGen/CGExprAgg.cpp CodeGen/CGExprComplex.cpp CodeGen/CGExprScalar.cpp Driver/Tools.cpp Serialization/ASTReaderDecl.cpp

John McCall rjmccall at apple.com
Fri Jan 6 15:08:09 PST 2012


On Jan 6, 2012, at 9:44 AM, Jakub Staszak wrote:
> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=147664&r1=147663&r2=147664&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Jan  6 11:44:30 2012
> @@ -469,7 +469,7 @@
>   llvm::BasicBlock *ContBlock = CGF.createBasicBlock("cond.end");
> 
>   // Bind the common expression if necessary.
> -  CodeGenFunction::OpaqueValueMapping binding(CGF, E);
> +  CodeGenFunction::OpaqueValueMapping(CGF, E);
> 
>   CodeGenFunction::ConditionalEvaluation eval(CGF);
>   CGF.EmitBranchOnBoolExpr(E->getCond(), LHSBlock, RHSBlock);

The obvious source of breakage here is that this is not at all semantically
equivalent.  The original statement declares an object that is destroyed
at the end of the scope.  Your replacement creates a temporary object
which is immediately destroyed.

GCC's unused-variable diagnostic should be made smarter;  this is
not an uncommon pattern.

John.



More information about the cfe-commits mailing list