[ASan] Add references to the issue tracker about malloc/free/new/delete mismatch...
[blocksruntime.git] / test / BlocksRuntime / globalexpression.c
blobeeedd75e707889e6b69769378e7b164b2a021e08
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
7 // testfilerunner CONFIG
9 #import <stdio.h>
10 #import <Block.h>
12 int global;
14 void (^gblock)(int) = ^(int x){ global = x; };
16 int main(int argc, char *argv[]) {
17 gblock(1);
18 if (global != 1) {
19 printf("%s: *** did not set global to 1\n", argv[0]);
20 return 1;
22 void (^gblockcopy)(int) = Block_copy(gblock);
23 if (gblockcopy != gblock) {
24 printf("global copy %p not a no-op %p\n", (void *)gblockcopy, (void *)gblock);
25 return 1;
27 Block_release(gblockcopy);
28 gblock(3);
29 if (global != 3) {
30 printf("%s: *** did not set global to 3\n", argv[0]);
31 return 1;
33 gblockcopy = Block_copy(gblock);
34 gblockcopy(5);
35 if (global != 5) {
36 printf("%s: *** did not set global to 5\n", argv[0]);
37 return 1;
39 printf("%s: Success!\n", argv[0]);
40 return 0;