Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-114271: Make _thread.lock thread-safe in free-threaded builds #116433

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

mpage
Copy link
Contributor

@mpage mpage commented Mar 6, 2024

Previously, the locked field was set after releasing the lock. This reverses the order so that the locked field is set while the lock is still held.

There is still one thread-safety issue where locked is checked prior to releasing the lock, however, in practice that will only be an issue when unlocking the lock is contended, which should be rare.

…in free-threaded builds

Previously, the `locked` field was set after releasing the lock. This reverses
the order so that the `locked` field is set while the lock is still held.

There is still one thread-safety issue where `locked` is checked prior to
releasing the lock, however, in practice that will only be an issue when
unlocking the lock is contended, which should be rare.
Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@colesbury colesbury merged commit c62144a into python:main Mar 6, 2024
37 checks passed
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian PGO 3.x has failed when building commit c62144a.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/249/builds/7957) and take a look at the build logs.
  4. Check if the failure is related to this commit (c62144a) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/249/builds/7957

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 7, done.        
remote: Counting objects:  14% (1/7)        
remote: Counting objects:  28% (2/7)        
remote: Counting objects:  42% (3/7)        
remote: Counting objects:  57% (4/7)        
remote: Counting objects:  71% (5/7)        
remote: Counting objects:  85% (6/7)        
remote: Counting objects: 100% (7/7)        
remote: Counting objects: 100% (7/7), done.        
remote: Compressing objects:  33% (1/3)        
remote: Compressing objects:  66% (2/3)        
remote: Compressing objects: 100% (3/3)        
remote: Compressing objects: 100% (3/3), done.        
remote: Total 4 (delta 3), reused 2 (delta 1), pack-reused 0        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to 'c62144a02cfae412a9deb4059fae141693a6edc9'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c62144a02cf gh-114271: Make `_thread.lock` thread-safe in free-threaded builds (#116433)
Switched to and reset branch 'main'

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:2996: clean-retain-profile] Error 1 (ignored)
In file included from Python/optimizer_analysis.c:380:
Python/optimizer_cases.c.h: In function ‘optimize_uops’:
Python/optimizer_cases.c.h:1134:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1134 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1133:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1133 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1151:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1151 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1150:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1150 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1163:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1163 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1162:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1162 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1175:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1175 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1174:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1174 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1187:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1187 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1186:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1186 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1199:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1199 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1198:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1198 |             _Py_UopsSymbol *right;
      |                             ^~~~~
./Modules/readline.c: In function ‘setup_readline’:
./Modules/readline.c:1305:21: warning: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(const char *, int)’ [-Wincompatible-pointer-types]
 1305 |     rl_startup_hook = on_startup_hook;
      |                     ^
./Modules/readline.c:1307:23: warning: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(const char *, int)’ [-Wincompatible-pointer-types]
 1307 |     rl_pre_input_hook = on_pre_input_hook;
      |                       ^
In file included from Python/optimizer_analysis.c:380:
Python/optimizer_cases.c.h: In function ‘optimize_uops’:
Python/optimizer_cases.c.h:1134:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1134 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1133:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1133 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1151:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1151 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1150:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1150 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1163:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1163 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1162:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1162 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1175:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1175 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1174:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1174 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1187:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1187 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1186:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1186 |             _Py_UopsSymbol *right;
      |                             ^~~~~
Python/optimizer_cases.c.h:1199:29: warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
 1199 |             _Py_UopsSymbol *left;
      |                             ^~~~
Python/optimizer_cases.c.h:1198:29: warning: variable ‘right’ set but not used [-Wunused-but-set-variable]
 1198 |             _Py_UopsSymbol *right;
      |                             ^~~~~
In function ‘word_to_string’,
    inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:411:13,
    inlined from ‘_mpd_to_string’ at ./Modules/_decimal/libmpdec/io.c:612:18:
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:360:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  360 |     case 15: EXTRACT_DIGIT(s, x, 100000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:359:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  359 |     case 16: EXTRACT_DIGIT(s, x, 1000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:360:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  360 |     case 15: EXTRACT_DIGIT(s, x, 100000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:361:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  361 |     case 14: EXTRACT_DIGIT(s, x, 10000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:358:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  358 |     case 17: EXTRACT_DIGIT(s, x, 10000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:357:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  357 |     case 18: EXTRACT_DIGIT(s, x, 100000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:358:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  358 |     case 17: EXTRACT_DIGIT(s, x, 10000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:359:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  359 |     case 16: EXTRACT_DIGIT(s, x, 1000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:362:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  362 |     case 13: EXTRACT_DIGIT(s, x, 1000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:361:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  361 |     case 14: EXTRACT_DIGIT(s, x, 10000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:362:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  362 |     case 13: EXTRACT_DIGIT(s, x, 1000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:363:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  363 |     case 12: EXTRACT_DIGIT(s, x, 100000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:364:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  364 |     case 11: EXTRACT_DIGIT(s, x, 10000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:363:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  363 |     case 12: EXTRACT_DIGIT(s, x, 100000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:364:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  364 |     case 11: EXTRACT_DIGIT(s, x, 10000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:366:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  366 |     case 10: EXTRACT_DIGIT(s, x, 1000000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:367:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  367 |     case 9:  EXTRACT_DIGIT(s, x, 100000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:366:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  366 |     case 10: EXTRACT_DIGIT(s, x, 1000000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:367:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  367 |     case 9:  EXTRACT_DIGIT(s, x, 100000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:368:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  368 |     case 8:  EXTRACT_DIGIT(s, x, 10000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:369:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  369 |     case 7:  EXTRACT_DIGIT(s, x, 1000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:368:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  368 |     case 8:  EXTRACT_DIGIT(s, x, 10000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:369:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  369 |     case 7:  EXTRACT_DIGIT(s, x, 1000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:370:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  370 |     case 6:  EXTRACT_DIGIT(s, x, 100000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:371:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  371 |     case 5:  EXTRACT_DIGIT(s, x, 10000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:372:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  372 |     case 4:  EXTRACT_DIGIT(s, x, 1000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:370:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  370 |     case 6:  EXTRACT_DIGIT(s, x, 100000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:371:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  371 |     case 5:  EXTRACT_DIGIT(s, x, 10000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:372:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  372 |     case 4:  EXTRACT_DIGIT(s, x, 1000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:373:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  373 |     case 3:  EXTRACT_DIGIT(s, x, 100UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:373:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  373 |     case 3:  EXTRACT_DIGIT(s, x, 100UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:374:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  374 |     case 2:  EXTRACT_DIGIT(s, x, 10UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:374:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  374 |     case 2:  EXTRACT_DIGIT(s, x, 10UL, dot);
      |              ^~~~~~~~~~~~~
In function ‘word_to_string’,
    inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:411:13,
    inlined from ‘_mpd_to_string’ at ./Modules/_decimal/libmpdec/io.c:608:18:
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:360:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  360 |     case 15: EXTRACT_DIGIT(s, x, 100000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:359:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  359 |     case 16: EXTRACT_DIGIT(s, x, 1000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:360:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  360 |     case 15: EXTRACT_DIGIT(s, x, 100000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:361:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  361 |     case 14: EXTRACT_DIGIT(s, x, 10000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:358:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  358 |     case 17: EXTRACT_DIGIT(s, x, 10000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:357:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  357 |     case 18: EXTRACT_DIGIT(s, x, 100000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:358:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  358 |     case 17: EXTRACT_DIGIT(s, x, 10000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:359:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  359 |     case 16: EXTRACT_DIGIT(s, x, 1000000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:362:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  362 |     case 13: EXTRACT_DIGIT(s, x, 1000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:361:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  361 |     case 14: EXTRACT_DIGIT(s, x, 10000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:362:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  362 |     case 13: EXTRACT_DIGIT(s, x, 1000000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:363:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  363 |     case 12: EXTRACT_DIGIT(s, x, 100000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:364:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  364 |     case 11: EXTRACT_DIGIT(s, x, 10000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:363:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  363 |     case 12: EXTRACT_DIGIT(s, x, 100000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:364:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  364 |     case 11: EXTRACT_DIGIT(s, x, 10000000000ULL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:366:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  366 |     case 10: EXTRACT_DIGIT(s, x, 1000000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:367:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  367 |     case 9:  EXTRACT_DIGIT(s, x, 100000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:366:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  366 |     case 10: EXTRACT_DIGIT(s, x, 1000000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:367:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  367 |     case 9:  EXTRACT_DIGIT(s, x, 100000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:368:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  368 |     case 8:  EXTRACT_DIGIT(s, x, 10000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:369:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  369 |     case 7:  EXTRACT_DIGIT(s, x, 1000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:368:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  368 |     case 8:  EXTRACT_DIGIT(s, x, 10000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:369:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  369 |     case 7:  EXTRACT_DIGIT(s, x, 1000000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:370:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  370 |     case 6:  EXTRACT_DIGIT(s, x, 100000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:371:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  371 |     case 5:  EXTRACT_DIGIT(s, x, 10000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:370:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  370 |     case 6:  EXTRACT_DIGIT(s, x, 100000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:371:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  371 |     case 5:  EXTRACT_DIGIT(s, x, 10000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:372:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  372 |     case 4:  EXTRACT_DIGIT(s, x, 1000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:373:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  373 |     case 3:  EXTRACT_DIGIT(s, x, 100UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:374:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  374 |     case 2:  EXTRACT_DIGIT(s, x, 10UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:372:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  372 |     case 4:  EXTRACT_DIGIT(s, x, 1000UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:373:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  373 |     case 3:  EXTRACT_DIGIT(s, x, 100UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:349:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  349 |         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~
./Modules/_decimal/libmpdec/io.c:374:14: note: in expansion of macro ‘EXTRACT_DIGIT’
  374 |     case 2:  EXTRACT_DIGIT(s, x, 10UL, dot);
      |              ^~~~~~~~~~~~~
./Modules/readline.c: In function ‘setup_readline’:
./Modules/readline.c:1305:21: warning: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(const char *, int)’ [-Wincompatible-pointer-types]
 1305 |     rl_startup_hook = on_startup_hook;
      |                     ^
./Modules/readline.c:1307:23: warning: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(const char *, int)’ [-Wincompatible-pointer-types]
 1307 |     rl_pre_input_hook = on_pre_input_hook;
      |                       ^
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘doParseXmlDecl’ at ./Modules/expat/xmltok.c:1192:13:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘doParseXmlDecl’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1070:9:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1076:12:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1076:12:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1083:9:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1083:9:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1110:7:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1123:9:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~
In function ‘utf8_toUtf8’,
    inlined from ‘toAscii’ at ./Modules/expat/xmltok.c:1038:3,
    inlined from ‘parsePseudoAttribute’ at ./Modules/expat/xmltok.c:1123:9:
./Modules/expat/xmltok.c:392:5: warning: ‘memcpy’ writing 2 or more bytes into a region of size 1 overflows the destination [-Wstringop-overflow=]
  392 |     memcpy(*toP, *fromP, bytesToCopy);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/expat/xmltok.c: In function ‘parsePseudoAttribute’:
./Modules/expat/xmltok.c:1036:8: note: destination object ‘buf’ of size 1
 1036 |   char buf[1];
      |        ^~~

make: *** [Makefile:2151: buildbottest] Error 3

@colesbury
Copy link
Contributor

The buildbot failure is unrelated to this PR (and I think it was fixed by #116434)

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
…lds (python#116433)

Previously, the `locked` field was set after releasing the lock. This reverses
the order so that the `locked` field is set while the lock is still held.

There is still one thread-safety issue where `locked` is checked prior to
releasing the lock, however, in practice that will only be an issue when
unlocking the lock is contended, which should be rare.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…lds (python#116433)

Previously, the `locked` field was set after releasing the lock. This reverses
the order so that the `locked` field is set while the lock is still held.

There is still one thread-safety issue where `locked` is checked prior to
releasing the lock, however, in practice that will only be an issue when
unlocking the lock is contended, which should be rare.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants