mirror of
https://github.com/python/cpython.git
synced 2025-12-19 07:03:48 +00:00
Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation
Clang 3.0 removes "y = *x;" instruction if the optimisation level is 3.
This commit is contained in:
parent
7ab4af0427
commit
a2477208c8
1 changed files with 4 additions and 1 deletions
|
|
@ -943,10 +943,13 @@ faulthandler_unregister_py(PyObject *self, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
faulthandler_read_null(PyObject *self, PyObject *args)
|
faulthandler_read_null(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int *x = NULL, y;
|
volatile int *x;
|
||||||
|
volatile int y;
|
||||||
int release_gil = 0;
|
int release_gil = 0;
|
||||||
if (!PyArg_ParseTuple(args, "|i:_read_null", &release_gil))
|
if (!PyArg_ParseTuple(args, "|i:_read_null", &release_gil))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
x = NULL;
|
||||||
if (release_gil) {
|
if (release_gil) {
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
y = *x;
|
y = *x;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue