]> git.saurik.com Git - apple/objc4.git/blob - test/release-workaround.m
objc4-818.2.tar.gz
[apple/objc4.git] / test / release-workaround.m
1 // TEST_CONFIG ARCH=x86_64 MEM=mrc
2 // TEST_CFLAGS -framework Foundation
3
4 // rdar://20206767
5
6 #include <Foundation/Foundation.h>
7 #include "test.h"
8
9
10 @interface Test : NSObject @end
11 @implementation Test
12 @end
13
14
15 int main()
16 {
17 id buf[1];
18 buf[0] = [Test class];
19 id obj = (id)buf;
20 [obj retain];
21 [obj retain];
22
23 uintptr_t rax;
24
25 [obj release];
26 asm("mov %%rax, %0" : "=r" (rax));
27 testassert(rax == 0);
28
29 objc_release(obj);
30 asm("mov %%rax, %0" : "=r" (rax));
31 testassert(rax == 0);
32
33 succeed(__FILE__);
34 }