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 // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
18 int main (int argc
, const char * argv
[]) {
19 __block BobTheStruct fiddly
;
22 void (^incrementFiddly
)() = ^{
30 memset(&fiddly
, 0xA5, sizeof(fiddly
));
31 memset(©
, 0x2A, sizeof(copy
));
35 fiddly
.ps
[i
] = i
* i
* i
;
36 fiddly
.qs
[i
] = -i
* i
* i
;
42 if ( ©
== &fiddly
) {
43 printf("%s: struct wasn't copied.", argv
[0]);
47 //printf("[%d]: fiddly.ps: %lu, copy.ps: %lu, fiddly.qs: %d, copy.qs: %d\n", i, fiddly.ps[i], copy.ps[i], fiddly.qs[i], copy.qs[i]);
48 if ( (fiddly
.ps
[i
] != copy
.ps
[i
] + 1) || (fiddly
.qs
[i
] != copy
.qs
[i
] + 1) ) {
49 printf("%s: struct contents were not incremented.", argv
[0]);
54 printf("%s: success\n", argv
[0]);