Compiling the following code with gcc-4.3 -Wlogical-op -O1 int main () { char *s, t; strchr (s, t); }
leads to this warning: test2.c: In function main: test2.c:7: warning: logical && with non-zero constant will always evaluate as true This is because libc defines strchr to a macro in bits/string.h. It looks to me like gcc should not warn about optimizations like __builtin_constant_p optimizations as those are diectly targeted at being optimized out. -- Summary: -Wlogical-op warns about strchr Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: otte at gnome dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513