]> granicus.if.org Git - python/commitdiff
Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 29 Jan 2012 23:07:43 +0000 (00:07 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 29 Jan 2012 23:07:43 +0000 (00:07 +0100)
Clang 3.0 removes "y = *x;" instruction if the optimisation level is 3.

Modules/faulthandler.c

index fcf4d0123910cd25a4b059ffb567f458832588cb..f18bbbc44ff3cefe13b30ff07fc5e4a294bca69b 100644 (file)
@@ -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;