| 1 |
/* { dg-options "-std=c99 -w" } */ |
| 2 |
/* From c_by_val.c in gfortran.dg. */ |
| 3 |
#define _Complex_I (1.0iF) |
| 4 |
|
| 5 |
#define NUM_ELEMS 10 |
| 6 |
|
| 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); |
| 14 |
|
| 15 |
int main (int argc, char **argv) |
| 16 |
{ |
| 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; |
| 24 |
|
| 25 |
c1 = 1.0 + 0.0 * _Complex_I; |
| 26 |
c2 = 2.0 + 0.0 * _Complex_I; |
| 27 |
c3 = 3.0 + 0.0 * _Complex_I; |
| 28 |
|
| 29 |
test_complex_scalars (&c1, &c2, &c3); |
| 30 |
|
| 31 |
for (i = 0; i < NUM_ELEMS; i++) |
| 32 |
{ |
| 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; |
| 36 |
} |
| 37 |
|
| 38 |
test_complex_arrays (c1_array, c2_array, c3_array, NUM_ELEMS); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |