| 1 |
/* PR middle-end/19551 */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
/* { dg-do link } */ |
| 4 |
|
| 5 |
extern void abort (); |
| 6 |
|
| 7 |
#define T(type, name) \ |
| 8 |
extern __attribute__((pure)) _Complex type \ |
| 9 |
foo_c##name (int x); \ |
| 10 |
\ |
| 11 |
void \ |
| 12 |
bar_c##name (type *x) \ |
| 13 |
{ \ |
| 14 |
type f = __real foo_c##name (5); \ |
| 15 |
if (0) *x = f; \ |
| 16 |
} \ |
| 17 |
\ |
| 18 |
void \ |
| 19 |
baz_c##name (type *x) \ |
| 20 |
{ \ |
| 21 |
type f = __imag foo_c##name (5); \ |
| 22 |
if (0) *x = f; \ |
| 23 |
} \ |
| 24 |
\ |
| 25 |
extern __attribute__((pure)) type \ |
| 26 |
foo_##name (int x); \ |
| 27 |
\ |
| 28 |
void \ |
| 29 |
bar_##name (type *x) \ |
| 30 |
{ \ |
| 31 |
type f = foo_##name (5); \ |
| 32 |
if (0) *x = f; \ |
| 33 |
} |
| 34 |
|
| 35 |
typedef long double ldouble_t; |
| 36 |
typedef long long llong; |
| 37 |
|
| 38 |
T (float, float) |
| 39 |
T (double, double) |
| 40 |
T (long double, ldouble_t) |
| 41 |
T (char, char) |
| 42 |
T (short, short) |
| 43 |
T (int, int) |
| 44 |
T (long, long) |
| 45 |
T (long long, llong) |
| 46 |
#undef T |
| 47 |
|
| 48 |
int |
| 49 |
main (void) |
| 50 |
{ |
| 51 |
#define T(type, name) \ |
| 52 |
{ \ |
| 53 |
type var = 0; \ |
| 54 |
bar_c##name (&var); \ |
| 55 |
baz_c##name (&var); \ |
| 56 |
bar_##name (&var); \ |
| 57 |
} |
| 58 |
T (float, float) |
| 59 |
T (double, double) |
| 60 |
T (long double, ldouble_t) |
| 61 |
T (char, char) |
| 62 |
T (short, short) |
| 63 |
T (int, int) |
| 64 |
T (long, long) |
| 65 |
T (long long, llong) |
| 66 |
return 0; |
| 67 |
} |