Index: include/clang/Basic/DiagnosticGroups.td
===================================================================
--- include/clang/Basic/DiagnosticGroups.td	(revision 202532)
+++ include/clang/Basic/DiagnosticGroups.td	(working copy)
@@ -397,6 +397,7 @@
 def ARCRepeatedUseOfWeak : DiagGroup<"arc-repeated-use-of-weak",
                                      [ARCRepeatedUseOfWeakMaybe]>;
 def ObjCBridge : DiagGroup<"bridge-cast">;
+def ARCImplicitWriteback : DiagGroup<"arc-implicit-writeback">;
 
 def DeallocInCategory:DiagGroup<"dealloc-in-category">;
 def SelectorTypeMismatch : DiagGroup<"selector-type-mismatch">;
Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 202532)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -835,6 +835,10 @@
   "but may be unpredictably set to nil; assign to a strong variable to keep "
   "the object alive">,
   InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
+def warn_arc_implicit_writeback : Warning <
+  "Variable is used both as __autoreleasing and __block, causing potentially "
+  "lossy writeback">,
+  InGroup<ARCImplicitWriteback>, DefaultIgnore;
 def warn_implicitly_retains_self : Warning <
   "block implicitly retains 'self'; explicitly mention 'self' to indicate "
   "this is intended behavior">,
Index: lib/Sema/SemaExprCXX.cpp
===================================================================
--- lib/Sema/SemaExprCXX.cpp	(revision 202532)
+++ lib/Sema/SemaExprCXX.cpp	(working copy)
@@ -2896,6 +2896,14 @@
           << (Action == AA_Casting) << From->getType() << ToType 
           << From->getSourceRange();
     }
+	
+	if (getLangOpts().ObjCAutoRefCount &&
+		Diags.getDiagnosticLevel(diag::warn_arc_implicit_writeback, From->getLocStart()) !=
+			DiagnosticsEngine::Ignored) {
+	  Diag(From->getLocStart(),
+	       diag::warn_arc_implicit_writeback)
+        << From->getSourceRange();
+	}
              
     CastKind Kind = CK_Invalid;
     CXXCastPath BasePath;
Index: lib/Sema/SemaInit.cpp
===================================================================
--- lib/Sema/SemaInit.cpp	(revision 202532)
+++ lib/Sema/SemaInit.cpp	(working copy)
@@ -4589,6 +4589,14 @@
     // If allowed, check whether this is an Objective-C writeback conversion.
     if (allowObjCWritebackConversion &&
         tryObjCWritebackConversion(S, *this, Entity, Initializer)) {
+
+      SourceLocation Loc = Initializer->getLocStart();
+      if (S.Diags.getDiagnosticLevel(diag::warn_arc_implicit_writeback,
+	                                 Loc) != DiagnosticsEngine::Ignored)
+        S.Diag(Loc,
+               diag::warn_arc_implicit_writeback)
+               << Initializer->getSourceRange();
+								   
       return;
     }
 
Index: test/SemaObjC/warn-implicit-writeback.m
===================================================================
--- test/SemaObjC/warn-implicit-writeback.m	(revision 0)
+++ test/SemaObjC/warn-implicit-writeback.m	(working copy)
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -Warc-implicit-writeback -verify %s
+
+id func(void)
+{
+    __block id value = @"initial value";
+    void (^block)(id *outValue) = ^(id *outValue){
+        value = @"hello";
+    };
+    block(&value); // expected-warning {{Variable is used both as __autoreleasing and __block, causing potentially lossy writeback}}
+	return value;
+}

Property changes on: test/SemaObjC/warn-implicit-writeback.m
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+header
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: test/SemaObjCXX/warn-implicit-writeback.mm
===================================================================
--- test/SemaObjCXX/warn-implicit-writeback.mm	(revision 0)
+++ test/SemaObjCXX/warn-implicit-writeback.mm	(working copy)
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -Warc-implicit-writeback -verify %s
+
+id func(void)
+{
+    __block id value = @"initial value"; // expected-warning {{Variable is used both as __autoreleasing and __block, causing potentially lossy writeback}}
+    void (^block)(id *outValue) = ^(id *outValue){
+        value = @"hello"; // expected-warning {{Variable is used both as __autoreleasing and __block, causing potentially lossy writeback}}
+    };
+    block(&value);
+	return value;
+}
