gcc/testsuite/gcc.dg/torture/pr115387-2.c
raw| 1 | /* Test there is no ICE when compile. */ |
| 2 | /* { dg-do compile } */ |
| 3 | |
| 4 | #include <stddef.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | char * |
| 8 | test (char *string, size_t maxlen) |
| 9 | { |
| 10 | string[0] = '\0'; |
| 11 | uintptr_t end; |
| 12 | |
| 13 | if (__builtin_add_overflow ((uintptr_t) string, maxlen, &end)) |
| 14 | end = -1; |
| 15 | |
| 16 | return (char *) end; |
| 17 | } |