2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / float-cast-overflow-4.c
blobaf76e4a3343362d97f640ae440cec7fab8504ea5
1 /* { dg-do run { target { lp64 } } } */
2 /* { dg-options "-fsanitize=float-cast-overflow" } */
4 #include <limits.h>
5 #include "float-cast.h"
7 int
8 main (void)
10 const long double inf = __builtin_infl ();
11 const long double nan = __builtin_nanl ("");
12 volatile long double ld;
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);
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);
30 return 0;
33 /* { dg-output "value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
34 /* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
35 /* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
36 /* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
37 /* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
38 /* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
39 /* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
40 /* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
41 /* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
42 /* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
43 /* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
44 /* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
45 /* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
46 /* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
47 /* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
48 /* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
49 /* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
50 /* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
51 /* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
52 /* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type" } */