We optimize
int f1(void) {
char buf[20]; strncpy(buf, "hi", 3); puts(buf);
}
to memcpy, but we bail out in the following case:
int f2(void) {
char buf[20]; strncpy(buf, "hi", 4); puts(buf);
}
This patch fixes it.
Godbolt: https://godbolt.org/g/ganpSH