summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-01-29 23:07:43 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2012-01-29 23:07:43 (GMT)
commita2477208c8bb94fe109f46b30d77d60276dfebe2 (patch)
tree57ed8c9212bb92eed22de6222ca44a3e0bcbff43 /Modules/faulthandler.c
parent7ab4af0427a100e1054dea6137381c5dbf843530 (diff)
downloadcpython-a2477208c8bb94fe109f46b30d77d60276dfebe2.zip
cpython-a2477208c8bb94fe109f46b30d77d60276dfebe2.tar.gz
cpython-a2477208c8bb94fe109f46b30d77d60276dfebe2.tar.bz2
Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation
Clang 3.0 removes "y = *x;" instruction if the optimisation level is 3.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index fcf4d01..f18bbbc 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -943,10 +943,13 @@ faulthandler_unregister_py(PyObject *self, PyObject *args)
static PyObject *
faulthandler_read_null(PyObject *self, PyObject *args)
{
- int *x = NULL, y;
+ volatile int *x;
+ volatile int y;
int release_gil = 0;
if (!PyArg_ParseTuple(args, "|i:_read_null", &release_gil))
return NULL;
+
+ x = NULL;
if (release_gil) {
Py_BEGIN_ALLOW_THREADS
y = *x;