mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #14180: Fix an invalid rounding when compiler optimization are enabled
Use volatile keyword to disable localy unsafe float optimizations.
This commit is contained in:
parent
87adda502a
commit
bd273c1ec3
1 changed files with 3 additions and 1 deletions
|
@ -102,7 +102,9 @@ _PyTime_ObjectToDenominator(PyObject *obj, time_t *sec, long *numerator,
|
|||
{
|
||||
assert(denominator <= LONG_MAX);
|
||||
if (PyFloat_Check(obj)) {
|
||||
double d, intpart, floatpart, err;
|
||||
double d, intpart, err;
|
||||
/* volatile avoids unsafe optimization on float enabled by gcc -O3 */
|
||||
volatile double floatpart;
|
||||
|
||||
d = PyFloat_AsDouble(obj);
|
||||
floatpart = modf(d, &intpart);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue