2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_f_pointer_complex_driver.c
blob6286c34111938affdc3ee358f15995ac3d99893a
1 /* { dg-options "-std=c99 -w" } */
2 /* From c_by_val.c in gfortran.dg. */
3 #define _Complex_I (1.0iF)
5 #define NUM_ELEMS 10
7 void test_complex_scalars (float _Complex *float_complex_ptr,
8 double _Complex *double_complex_ptr,
9 long double _Complex *long_double_complex_ptr);
10 void test_complex_arrays (float _Complex *float_complex_array,
11 double _Complex *double_complex_array,
12 long double _Complex *long_double_complex_array,
13 int num_elems);
15 int main (int argc, char **argv)
17 float _Complex c1;
18 double _Complex c2;
19 long double _Complex c3;
20 float _Complex c1_array[NUM_ELEMS];
21 double _Complex c2_array[NUM_ELEMS];
22 long double _Complex c3_array[NUM_ELEMS];
23 int i;
25 c1 = 1.0 + 0.0 * _Complex_I;
26 c2 = 2.0 + 0.0 * _Complex_I;
27 c3 = 3.0 + 0.0 * _Complex_I;
29 test_complex_scalars (&c1, &c2, &c3);
31 for (i = 0; i < NUM_ELEMS; i++)
33 c1_array[i] = 1.0 * (i+1) + 0.0 * _Complex_I;
34 c2_array[i] = 1.0 * (i+1) + 0.0 * _Complex_I;
35 c3_array[i] = 1.0 * (i+1) + 0.0 * _Complex_I;
38 test_complex_arrays (c1_array, c2_array, c3_array, NUM_ELEMS);
40 return 0;