On Mon, Mar 07, 2011 at 05:15:18PM +0100, Jim Meyering wrote:
With the former and -O3, I do see your warning.
Here's a pared-down test case:
$ cat k.c
#include <string.h>
void do_rm_rf (const char *p) { if (strcmp (p, "/") == 0) return; }
$ gcc -Wall -O3 -c k.c -Werror=strict-overflow
k.c: In function ‘do_rm_rf’:
k.c:2:1678: error: assuming signed overflow does not occur when changing X +- C1 cmp
C2 to X cmp C1 +- C2 [-Werror=strict-overflow]
cc1: some warnings being treated as errors
FYI, as a workaround -D__NO_STRING_INLINES should work, then strcmp
isn't expanded to the fancy glibc expansion...
Jakub