[notting@nostromo: ~]$ cat foo.c #include <stdio.h> #include <string.h> int main() { char *foo = ".."; printf("%d\n", strncmp(foo, ".",1)); return 0; } [notting@nostromo: ~]$ gcc -Wall -o foo foo.c -O2 foo.c: In function ‘main’: foo.c:6: warning: offset ‘3’ outside bounds of constant string Turning off optimization (or parens around strncmp) fixes the warning. Version-Release number of selected component (if applicable): gcc-4.4.0-0.30.x86_64 glibc-devel-2.9.90-11.x86_64 How reproducible: 100%
*** This bug has been marked as a duplicate of bug 492846 ***