Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / BlocksRuntime / byrefcopyinner.c
blob004474750d64224b0b698b88047bf5f2d235d93a
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
6 #include <Block.h>
7 #include <stdio.h>
9 // CONFIG rdar://6225809
10 // fixed in 5623
12 int main(int argc, char *argv[]) {
13 __block int a = 42;
14 int* ap = &a; // just to keep the address on the stack.
16 void (^b)(void) = ^{
17 //a; // workaround, a should be implicitly imported
18 Block_copy(^{
19 a = 2;
20 });
23 Block_copy(b);
25 if(&a == ap) {
26 printf("**** __block heap storage should have been created at this point\n");
27 return 1;
29 printf("%s: Success\n", argv[0]);
30 return 0;