[cfe-commits] r39928 - /cfe/trunk/Sema/SemaExpr.cpp

Chris Lattner sabre at nondot.org
Mon Jul 16 14:39:03 PDT 2007


Author: lattner
Date: Mon Jul 16 16:39:03 2007
New Revision: 39928

URL: http://llvm.org/viewvc/llvm-project?rev=39928&view=rev
Log:
Fix a GCC warning:
SemaExpr.cpp:561: warning: dereferencing type-punned pointer will break strict-aliasing rules

Patch by Benoit Boissinot!


Modified:
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=39928&r1=39927&r2=39928&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Jul 16 16:39:03 2007
@@ -558,11 +558,13 @@
                                             SourceLocation ColonLoc,
                                             ExprTy *Cond, ExprTy *LHS,
                                             ExprTy *RHS) {
-  QualType result = CheckConditionalOperands((Expr *&)Cond, (Expr *&)LHS, 
-                                             (Expr *&)RHS, QuestionLoc);
+  Expr *CondExpr = (Expr *) Cond;
+  Expr *LHSExpr = (Expr *) LHS, *RHSExpr = (Expr *) RHS;
+  QualType result = CheckConditionalOperands(CondExpr, LHSExpr, 
+                                             RHSExpr, QuestionLoc);
   if (result.isNull())
     return true;
-  return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS, result);
+  return new ConditionalOperator(CondExpr, LHSExpr, RHSExpr, result);
 }
 
 // promoteExprToType - a helper function to ensure we create exactly one 





More information about the cfe-commits mailing list