public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95149] New: lex.c:1729:8: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
@ 2020-05-15 10:26 marxin at gcc dot gnu.org
  2020-05-15 10:32 ` [Bug c++/95149] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-15 10:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95149

            Bug ID: 95149
           Summary: lex.c:1729:8: warning: result of comparison against a
                    string literal is unspecified (use an explicit string
                    comparison function instead) [-Wstring-compare]
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org, nathan at gcc dot gnu.org
  Target Milestone: ---

I see the following Clang warnings for lex.c. It comes from:

1729:         BUF_APPEND ("\\", 1);

#define BUF_APPEND(STR,LEN)                                     \
      do {                                                      \
        bufring_append (pfile, (const uchar *)(STR), (LEN),     \
                        &first_buff, &last_buff);               \
        total_len += (LEN);                                     \
        if (__builtin_expect (temp_buffer_len < 17, 0)          \
            && (const uchar *)(STR) != base                     \
            && (LEN) <= 2)                                      \
          {                                                     \
            memcpy (temp_buffer + temp_buffer_len,              \
                    (const uchar *)(STR), (LEN));               \
            temp_buffer_len += (LEN);                           \
          }                                                     \
      } while (0)

If I see correctly the problematic comparison is '(const uchar *)(STR) != base'
which is really a comparison in between a string literal and a local variable.

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

end of thread, other threads:[~2020-05-19 19:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 10:26 [Bug c++/95149] New: lex.c:1729:8: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare] marxin at gcc dot gnu.org
2020-05-15 10:32 ` [Bug c++/95149] " jakub at gcc dot gnu.org
2020-05-15 10:36 ` jakub at gcc dot gnu.org
2020-05-15 11:09 ` pinskia at gcc dot gnu.org
2020-05-19 18:41 ` nathan at gcc dot gnu.org
2020-05-19 19:27 ` marxin at gcc dot gnu.org

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).