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 open rdar://6439600
7
8#import <stdio.h>
9#import <stdlib.h>
10
11#define NUMBER_OF_BLOCKS 100
12int main (int argc, const char * argv[]) {
13 int (^x[NUMBER_OF_BLOCKS])();
14 int i;
15
16 for(i=0; i<NUMBER_OF_BLOCKS; i++) x[i] = ^{ return i; };
17
18 for(i=0; i<NUMBER_OF_BLOCKS; i++) {
19 if (x[i]() != i) {
20 printf(format: "%s: failure, %d != %d\n", argv[0], x[i](), i);
21 exit(status: 1);
22 }
23 }
24
25 printf(format: "%s: success\n", argv[0]);
26
27 return 0;
28}
29

source code of compiler-rt/test/BlocksRuntime/copy-block-literal-rdar6439600.c