diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-03 14:33:16 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-03 14:33:16 (GMT) |
commit | 5786aef382b0f64720060d6372c215e939461957 (patch) | |
tree | 364af1c1268efdec259446309b2b8d956de3cb18 /Python | |
parent | 29ee6745af8ace80cef04c18b232771e8b00acdb (diff) | |
download | cpython-5786aef382b0f64720060d6372c215e939461957.zip cpython-5786aef382b0f64720060d6372c215e939461957.tar.gz cpython-5786aef382b0f64720060d6372c215e939461957.tar.bz2 |
Don't abuse volatile keyword in pytime.c
Only use it on the most important number. This change fixes also a compiler
warning on modf().
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pytime.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pytime.c b/Python/pytime.c index cea3cf5..d226389 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -135,8 +135,9 @@ int _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) { if (PyFloat_Check(obj)) { + double intpart, err; /* volatile avoids optimization changing how numbers are rounded */ - volatile double d, intpart, err; + volatile double d; d = PyFloat_AsDouble(obj); if (round == _PyTime_ROUND_HALF_UP) @@ -257,8 +258,9 @@ static int _PyTime_FromFloatObject(_PyTime_t *t, double value, _PyTime_round_t round, long to_nanoseconds) { + double err; /* volatile avoids optimization changing how numbers are rounded */ - volatile double d, err; + volatile double d; /* convert to a number of nanoseconds */ d = value; |