]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 (GH-24384)
authorPablo Galindo <Pablogsal@gmail.com>
Sat, 30 Jan 2021 13:54:22 +0000 (13:54 +0000)
committerGitHub <noreply@github.com>
Sat, 30 Jan 2021 13:54:22 +0000 (22:54 +0900)
Objects/codeobject.c
Python/compile.c

index f7613e8fd21b1250e779cb4b06fba9d08734b7d0..69cb31c1ababc987ab1d21f45a2c09b574fe9ae6 100644 (file)
@@ -408,8 +408,8 @@ emit_pair(PyObject **bytes, int *offset, int a, int b)
         if (_PyBytes_Resize(bytes, len * 2) < 0)
             return 0;
     }
-    unsigned char *lnotab = (unsigned char *)
-                    PyBytes_AS_STRING(*bytes) + *offset;
+    unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(*bytes);
+    lnotab += *offset;
     *lnotab++ = a;
     *lnotab++ = b;
     *offset += 2;
index 8abb5bb5dc655146cf2c5234f51aeb4d006eca7f..9927f5abfb964c1910304b01da8e540edb348902 100644 (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)
             return 0;
     }
-    unsigned char *lnotab = (unsigned char *)
-                    PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
-
+    unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(a->a_lnotab);
+    lnotab += a->a_lnotab_off;
     a->a_lnotab_off += 2;
     *lnotab++ = bdelta;
     *lnotab++ = ldelta;