PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_loc_tests_2_funcs.c
blobd47ac81aeaa7a31e2230e6f5d695e9a3186b11a2
1 double fabs (double);
3 typedef struct ctype
5 int i;
6 double x;
7 }ctype_t;
9 int test_scalar_address(int *ptr)
11 /* The value in Fortran should be initialized to 100. */
12 if(*ptr != 100)
13 return 0;
14 else
15 return 1;
18 int test_array_address(int *int_array, int num_elements)
20 int i = 0;
22 for(i = 0; i < num_elements; i++)
23 /* Fortran will init all of the elements to 100; verify that here. */
24 if(int_array[i] != 100)
25 return 0;
27 /* all elements were equal to 100 */
28 return 1;
31 int test_type_address(ctype_t *type_ptr)
33 /* i was set to 100 by Fortran */
34 if(type_ptr->i != 100)
35 return 0;
37 /* x was set to 1.0d0 by Fortran */
38 if(fabs(type_ptr->x - 1.0) > 0.00000000)
39 return 0;
41 return 1;