| 1 |
/* { dg-options "-O0" } */ |
| 2 |
|
| 3 |
/* C99 6.5.15 Conditional operator. |
| 4 |
Test with decimal float operands. */ |
| 5 |
|
| 6 |
#include "dfp-dbg.h" |
| 7 |
|
| 8 |
volatile _Decimal32 d32a, d32b, d32c; |
| 9 |
volatile _Decimal64 d64a, d64b, d64c; |
| 10 |
volatile _Decimal128 d128a, d128b, d128c; |
| 11 |
volatile int i, yes, no; |
| 12 |
|
| 13 |
void |
| 14 |
init () |
| 15 |
{ |
| 16 |
d32b = 123.456e94df; |
| 17 |
d64b = 12.3456789012345e383dd; |
| 18 |
d128b = 12345.6789012345678901e4000dl; |
| 19 |
|
| 20 |
d32c = 1.3df; |
| 21 |
d64c = 1.2dd; |
| 22 |
d128c = 1.1dl; |
| 23 |
|
| 24 |
i = 2; |
| 25 |
yes = 1; |
| 26 |
no = 0; |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
main () |
| 31 |
{ |
| 32 |
init (); |
| 33 |
|
| 34 |
/* Operands and the result are all the same decimal float type. */ |
| 35 |
d32a = yes ? d32b : d32c; |
| 36 |
if (d32a != d32b) |
| 37 |
FAILURE |
| 38 |
d64a = no ? d64b : d64c; |
| 39 |
if (d64a != d64c) |
| 40 |
FAILURE |
| 41 |
d128a = yes ? d128b : d128c; |
| 42 |
if (d128a != d128b) |
| 43 |
FAILURE |
| 44 |
|
| 45 |
/* Operand types are different. */ |
| 46 |
d128a = yes ? d32b : d64b; |
| 47 |
if (d128a != d32b) |
| 48 |
FAILURE |
| 49 |
d128a = yes ? d128b : d64b; |
| 50 |
if (d128a != d128b) |
| 51 |
FAILURE |
| 52 |
d128a = no ? d32b : d128b; |
| 53 |
if (d128a != d128b) |
| 54 |
FAILURE |
| 55 |
|
| 56 |
FINISH |
| 57 |
} |