diff options
Diffstat (limited to 'newlib/testsuite/newlib.stdlib/size_max.c')
-rw-r--r-- | newlib/testsuite/newlib.stdlib/size_max.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/newlib/testsuite/newlib.stdlib/size_max.c b/newlib/testsuite/newlib.stdlib/size_max.c new file mode 100644 index 000000000..d163e27d1 --- /dev/null +++ b/newlib/testsuite/newlib.stdlib/size_max.c @@ -0,0 +1,18 @@ +#include <stddef.h> +#include <stdint.h> +#include <stdlib.h> + +int main () { + size_t s; + + s = SIZE_MAX; + /* If SIZE_MAX is truncated when assigning to "s", then SIZE_MAX is + too big. */ + if (s != SIZE_MAX) + abort (); + /* If SIZE_MAX + 1 is not zero, then SIZE_MAX is not big enough. */ + if (++s != 0) + abort (); + + return 0; +} |