[Python-checkins] cpython: Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation

victor.stinner python-checkins at python.org
Mon Jan 30 00:07:33 CET 2012


http://hg.python.org/cpython/rev/f71249d785d6
changeset:   74682:f71249d785d6
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon Jan 30 00:07:43 2012 +0100
summary:
  Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation

Clang 3.0 removes "y = *x;" instruction if the optimisation level is 3.

files:
  Modules/faulthandler.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -943,10 +943,13 @@
 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;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list