[ASan] Add references to the issue tracker about malloc/free/new/delete mismatch...
[blocksruntime.git] / test / BlocksRuntime / large-struct.c
blob1867bd02dfab1e28bf95f842569ea39f983ad1f9
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 // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
8 // CONFIG
10 #import <stdio.h>
11 #import <stdlib.h>
12 #import <string.h>
14 typedef struct {
15 unsigned long ps[30];
16 int qs[30];
17 } BobTheStruct;
19 int main (int argc, const char * argv[]) {
20 BobTheStruct inny;
21 BobTheStruct outty;
22 BobTheStruct (^copyStruct)(BobTheStruct);
23 int i;
25 memset(&inny, 0xA5, sizeof(inny));
26 memset(&outty, 0x2A, sizeof(outty));
28 for(i=0; i<30; i++) {
29 inny.ps[i] = i * i * i;
30 inny.qs[i] = -i * i * i;
33 copyStruct = ^(BobTheStruct aBigStruct){ return aBigStruct; }; // pass-by-value intrinsically copies the argument
35 outty = copyStruct(inny);
37 if ( &inny == &outty ) {
38 printf("%s: struct wasn't copied.", argv[0]);
39 exit(1);
41 for(i=0; i<30; i++) {
42 if ( (inny.ps[i] != outty.ps[i]) || (inny.qs[i] != outty.qs[i]) ) {
43 printf("%s: struct contents did not match.", argv[0]);
44 exit(1);
48 printf("%s: success\n", argv[0]);
50 return 0;