| 1 |
/* { dg-do run { target { lp64 } } } */ |
| 2 |
/* { dg-options "-fsanitize=float-cast-overflow -Wno-overflow" } */ |
| 3 |
|
| 4 |
#include <limits.h> |
| 5 |
#include "float-cast.h" |
| 6 |
|
| 7 |
int |
| 8 |
main (void) |
| 9 |
{ |
| 10 |
const long double inf = __builtin_infl (); |
| 11 |
const long double nan = __builtin_nanl (""); |
| 12 |
volatile long double ld; |
| 13 |
|
| 14 |
volatile int i; |
| 15 |
ld = INT_MIN; |
| 16 |
CHECK_BOUNDARY (i, ld); |
| 17 |
ld = 0.0l; |
| 18 |
CHECK_BOUNDARY (i, ld); |
| 19 |
ld = INT_MAX; |
| 20 |
CHECK_BOUNDARY (i, ld); |
| 21 |
CHECK_NONNUMBERS (i); |
| 22 |
|
| 23 |
volatile unsigned int u; |
| 24 |
ld = UINT_MAX; |
| 25 |
CHECK_BOUNDARY (u, ld); |
| 26 |
ld = 0.0l; |
| 27 |
CHECK_BOUNDARY (u, ld); |
| 28 |
CHECK_NONNUMBERS (u); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-output " -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 34 |
/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 35 |
/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 36 |
/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 37 |
/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 38 |
/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 39 |
/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 40 |
/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 41 |
/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 42 |
/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 43 |
/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 44 |
/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 45 |
/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 46 |
/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 47 |
/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 48 |
/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 49 |
/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 50 |
/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 51 |
/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */ |
| 52 |
/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type" } */ |