[cfe-commits] r116917 - /cfe/trunk/lib/Rewrite/RewriteObjC.cpp

Duncan Sands baldrick at free.fr
Wed Oct 20 01:21:16 PDT 2010


Author: baldrick
Date: Wed Oct 20 03:21:16 2010
New Revision: 116917

URL: http://llvm.org/viewvc/llvm-project?rev=116917&view=rev
Log:
GCC 4.4 warns that Receiver may be used uninitialized in this function.
As far as I can see, gcc is right to think this!  The following change
will cause a nice segfault rather than undefined behaviour if this case
occurs.  Someone who understands what this code is supposed to do should
probably take a proper look.

Modified:
    cfe/trunk/lib/Rewrite/RewriteObjC.cpp

Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=116917&r1=116916&r2=116917&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Wed Oct 20 03:21:16 2010
@@ -1213,7 +1213,7 @@
   ObjCMethodDecl *OMD = 0;
   QualType Ty;
   Selector Sel;
-  Stmt *Receiver;
+  Stmt *Receiver = 0;
   bool Super = false;
   QualType SuperTy;
   SourceLocation SuperLocation;





More information about the cfe-commits mailing list