1//
2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3// See https://llvm.org/LICENSE.txt for license information.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
6// CONFIG rdar://6405500
7
8#include <stdio.h>
9#include <stdlib.h>
10#import <dispatch/dispatch.h>
11#import <objc/objc-auto.h>
12
13int main (int argc, const char * argv[]) {
14 __block void (^blockFu)(size_t t);
15 blockFu = ^(size_t t){
16 if (t == 20) {
17 printf("%s: success\n", argv[0]);
18 exit(0);
19 } else
20 dispatch_async(dispatch_get_main_queue(), ^{ blockFu(20); });
21 };
22
23 dispatch_apply(10, dispatch_get_concurrent_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT), blockFu);
24
25 dispatch_main();
26 printf(format: "shouldn't get here\n");
27 return 1;
28}
29

source code of compiler-rt/test/BlocksRuntime/rdar6405500.c