[New-bugs-announce] [issue45713] gcc warning when compiling Modules/expat/xmltok_ns.c

vamsi kalapala report at bugs.python.org
Thu Nov 4 09:38:37 EDT 2021


New submission from vamsi kalapala <vamsi1281977 at gmail.com>:

The code that triggers the compiler warning is:

NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) {
#  define ENCODING_MAX 128
  char buf[ENCODING_MAX];  /// <==== THIS GIVES A WARNING.
  // THE FIX IS ====> char buf[ENCODING_MAX] = "";
  char *p = buf;
  int i;
  XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
  if (ptr != end)
    return 0;
  *p = 0;
  if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
    return enc;
  i = getEncodingIndex(buf);
  if (i == UNKNOWN_ENC)
    return 0;
  return NS(encodings)[i];
}

----------
messages: 405717
nosy: vamsi1281977
priority: normal
severity: normal
status: open
title: gcc warning when compiling Modules/expat/xmltok_ns.c
type: compile error
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45713>
_______________________________________


More information about the New-bugs-announce mailing list