1 // { dg-do run { target { int32 } } }
2 // { dg-options "-fsanitize=float-cast-overflow" }
4 #define INT_MAX __INT_MAX__
5 #define INT_MIN (-__INT_MAX__ - 1)
6 #define UINT_MAX 2 * (unsigned) __INT_MAX__ + 1
23 #define CHECK_BOUNDARY(VAR, VAL) \
24 (VAR) = (VAL) - 1.5; \
25 (VAR) = (VAL) - 1.0; \
26 (VAR) = (VAL) - 0.75; \
27 (VAR) = (VAL) - 0.5; \
28 (VAR) = (VAL) - 0.0000001; \
29 (VAR) = (VAL) - 0.0; \
31 (VAR) = (VAL) + 0.0; \
32 (VAR) = (VAL) + 0.0000001; \
33 (VAR) = (VAL) + 0.5; \
34 (VAR) = (VAL) + 0.75; \
35 (VAR) = (VAL) + 1.0; \
38 /* Signed bit-field. (INT_MIN, INT_MAX) is valid. */
40 CHECK_BOUNDARY (s.i, d);
42 CHECK_BOUNDARY (s.i, d);
44 CHECK_BOUNDARY (s.i, d);
46 /* Unsigned bit-field. (0, UINT_MAX) is valid. */
48 CHECK_BOUNDARY (t.i, d);
50 CHECK_BOUNDARY (t.i, d);
55 /* { dg-output " -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
56 /* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
57 /* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
58 /* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
59 /* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
60 /* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
61 /* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
62 /* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type" } */