[cfe-commits] r65751 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp test/CodeGenObjC/blocks-unsupported.m

Anders Carlsson andersca at mac.com
Sun Mar 1 13:05:48 PST 2009


On Mar 1, 2009, at 12:35 PM, Mike Stump wrote:

> On Mar 1, 2009, at 12:22 PM, Anders Carlsson wrote:
>> I did not! :) That's good news!
>>
>> However, __block variables are still allocated on the stack, even  
>> when copied.
>
> And that is a private implementation detail you aren't allowed to  
> know about, I believe.  Can you write a testcase that can validly  
> tell?

void (^f(void))(void)
{
     __block int a;

     return Block_copy(^{
         a = 10;
     });
}

void g()
{
	f()();
}

is going to blow up because the returned block references a stack  
variable that doesn't exist.

Anders





More information about the cfe-commits mailing list