fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / test_c_assoc.c
blobaa6571874aeb528530d24c71da4b4f971d82cb5b
1 /* use 0 for NULL so no need for system header */
3 int test_c_assoc_0(void *my_c_ptr);
4 int test_c_assoc_1(void *my_c_ptr_1, void *my_c_ptr_2);
5 int test_c_assoc_2(void *my_c_ptr_1, void *my_c_ptr_2, int num_ptrs);
6 void verify_assoc(void *my_c_ptr_1, void *my_c_ptr_2);
8 extern void abort(void);
10 int main(int argc, char **argv)
12 int i;
13 int j;
15 if(test_c_assoc_0(0) != 0)
16 abort();
18 if(test_c_assoc_0(&i) != 1)
19 abort();
21 if(test_c_assoc_1(0, 0) != 0)
22 abort();
24 if(test_c_assoc_1(0, &i) != 0)
25 abort();
27 if(test_c_assoc_1(&i, &i) != 1)
28 abort();
30 if(test_c_assoc_1(&i, 0) != 0)
31 abort();
33 if(test_c_assoc_1(&i, &j) != 0)
34 abort();
36 /* this should be associated, cause only testing 1 ptr (i) */
37 if(test_c_assoc_2(&i, 0, 1) != 1)
38 abort();
40 /* this should be associated */
41 if(test_c_assoc_2(&i, &i, 2) != 1)
42 abort();
44 /* this should not be associated (i) */
45 if(test_c_assoc_2(&i, &j, 2) != 0)
46 abort();
48 /* this should be associated, cause only testing 1 ptr (i) */
49 if(test_c_assoc_2(&i, &j, 1) != 1)
50 abort();
52 verify_assoc(&i, &i);
54 return 0;
55 }/* end main() */