On Jan 4, 2013, at 4:44 PM, John McCall wrote: > On Jan 4, 2013, at 4:34 PM, Fariborz Jahanian <[email protected]> wrote: >> On Jan 4, 2013, at 3:56 PM, John McCall wrote: >>>> >>> >>> You need to initialize the destination to null (with a simple store) before >>> doing a storeStrong to it. >> In r171572. This is I assume to prevent storeStrong from releasing the old >> value. I guess this should not happen >> in this context, > > Right. objc_storeStrong is an assignment, not an initialization; it reads > the old value out of the destination and releases it. When moving a __block > variable to the heap, libclosure basically allocates some memory, sets up the > byref header, and then checks whether there's a copy helper; if there is, it > invokes it immediately. Therefore, when we're invoked, the destination > address is freshly-allocated memory, and we cannot rely on it having been > zero-initialized.
Makes sense. Thanks. - Fariborz > > John. > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
