bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 (GH-24384)

This commit is contained in:
Pablo Galindo 2021-01-30 13:54:22 +00:00 committed by GitHub
parent 62437a2fa9
commit 86e322f141
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -408,8 +408,8 @@ emit_pair(PyObject **bytes, int *offset, int a, int b)
if (_PyBytes_Resize(bytes, len * 2) < 0) if (_PyBytes_Resize(bytes, len * 2) < 0)
return 0; return 0;
} }
unsigned char *lnotab = (unsigned char *) unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(*bytes);
PyBytes_AS_STRING(*bytes) + *offset; lnotab += *offset;
*lnotab++ = a; *lnotab++ = a;
*lnotab++ = b; *lnotab++ = b;
*offset += 2; *offset += 2;

View file

@ -5577,9 +5577,8 @@ assemble_emit_linetable_pair(struct assembler *a, int bdelta, int ldelta)
if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0) if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0)
return 0; return 0;
} }
unsigned char *lnotab = (unsigned char *) unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(a->a_lnotab);
PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; lnotab += a->a_lnotab_off;
a->a_lnotab_off += 2; a->a_lnotab_off += 2;
*lnotab++ = bdelta; *lnotab++ = bdelta;
*lnotab++ = ldelta; *lnotab++ = ldelta;