| 1 |
/* N1150 5.1 Conversion between decimal floating integer. |
| 2 |
C99 6.3.1.4(1a) New. |
| 3 |
Test integer saturation. */ |
| 4 |
|
| 5 |
/* { dg-options "-fno-trapping-math" } */ |
| 6 |
#ifndef __STDC_WANT_DEC_FP__ |
| 7 |
#define __STDC_WANT_DEC_FP__ 1 |
| 8 |
#endif |
| 9 |
|
| 10 |
#include "dfp-dbg.h" |
| 11 |
#include <float.h> |
| 12 |
#include <limits.h> |
| 13 |
|
| 14 |
volatile _Decimal32 d32; |
| 15 |
volatile _Decimal64 d64; |
| 16 |
volatile _Decimal128 d128; |
| 17 |
|
| 18 |
volatile signed int si; |
| 19 |
volatile unsigned int usi; |
| 20 |
volatile unsigned long long udi; |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
|
| 26 |
/* Unsigned. */ |
| 27 |
usi = DEC32_MAX; /* { dg-warning "overflow in conversion" } */ |
| 28 |
if (usi != UINT_MAX) |
| 29 |
FAILURE |
| 30 |
|
| 31 |
usi = DEC64_MAX; /* { dg-warning "overflow in conversion" } */ |
| 32 |
if (usi != UINT_MAX) |
| 33 |
FAILURE |
| 34 |
|
| 35 |
usi = DEC128_MAX; /* { dg-warning "overflow in conversion" } */ |
| 36 |
if (usi != UINT_MAX) |
| 37 |
FAILURE |
| 38 |
|
| 39 |
/* Signed. */ |
| 40 |
si = DEC32_MAX; /* { dg-warning "overflow in conversion" } */ |
| 41 |
if (si != INT_MAX) |
| 42 |
FAILURE |
| 43 |
|
| 44 |
si = DEC64_MAX; /* { dg-warning "overflow in conversion" } */ |
| 45 |
if (si != INT_MAX) |
| 46 |
FAILURE |
| 47 |
|
| 48 |
si = DEC128_MAX; /* { dg-warning "overflow in conversion" } */ |
| 49 |
if (si != INT_MAX) |
| 50 |
FAILURE |
| 51 |
|
| 52 |
si = - DEC32_MAX; /* { dg-warning "overflow in conversion" } */ |
| 53 |
if (si != INT_MIN) |
| 54 |
FAILURE |
| 55 |
|
| 56 |
si = - DEC64_MAX; /* { dg-warning "overflow in conversion" } */ |
| 57 |
if (si != INT_MIN) |
| 58 |
FAILURE |
| 59 |
|
| 60 |
si = - DEC128_MAX; /* { dg-warning "overflow in conversion" } */ |
| 61 |
if (si != INT_MIN) |
| 62 |
FAILURE |
| 63 |
|
| 64 |
FINISH |
| 65 |
} |