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.

Reply via email to