public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36513]  New: -Wlogical-op warns about strchr
@ 2008-06-12 19:01 otte at gnome dot org
  2008-06-12 19:09 ` [Bug c/36513] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: otte at gnome dot org @ 2008-06-12 19:01 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-02-23 13:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-12 19:01 [Bug c/36513] New: -Wlogical-op warns about strchr otte at gnome dot org
2008-06-12 19:09 ` [Bug c/36513] " pinskia at gcc dot gnu dot org
2009-02-11 22:13 ` [Bug target/36513] " manu at gcc dot gnu dot org
2009-05-15 20:13 ` manu at gcc dot gnu dot org
2009-05-17  9:06 ` otte at gnome dot org
2009-05-17 16:40 ` manu at gcc dot gnu dot org
2009-11-25 10:03 ` johan dot gill at gmail dot com
2009-11-25 10:06 ` johan dot gill at gmail dot com
2009-11-25 10:26 ` johan dot gill at gmail dot com
2009-11-25 13:43 ` manu at gcc dot gnu dot org
2009-11-25 13:43 ` manu at gcc dot gnu dot org
2010-02-19 21:22 ` manu at gcc dot gnu dot org
2010-02-19 21:25 ` manu at gcc dot gnu dot org
2010-02-23 13:58 ` hjl dot tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).