This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36513] New: -Wlogical-op warns about strchr
- From: "otte at gnome dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jun 2008 19:00:41 -0000
- Subject: [Bug c/36513] New: -Wlogical-op warns about strchr
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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