New submission from Christian Heimes <[email protected]>:
clang 10 with asan and ubsan complains about implicit int to float conversion
in time and math related code:
$ CC=clang ./configure --with-address-sanitizer
--with-undefined-behavior-sanitizer
$ make clean
$ make -s
Python/pytime.c:154:10: warning: implicit conversion from 'long' to 'double'
changes value from 9223372036854775807 to 9223372036854775808
[-Wimplicit-int-float-conversion]
if (!_Py_InIntegralTypeRange(time_t, intpart)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymath.h:228:82: note: expanded from macro '_Py_InIntegralTypeRange'
#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v
<= _Py_IntegralTypeMax(type))
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymath.h:221:124: note: expanded from macro '_Py_IntegralTypeMax'
#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1
<< (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Python/pytime.c:207:14: warning: implicit conversion from 'long' to 'double'
changes value from 9223372036854775807 to 9223372036854775808
[-Wimplicit-int-float-conversion]
if (!_Py_InIntegralTypeRange(time_t, intpart)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymath.h:228:82: note: expanded from macro '_Py_InIntegralTypeRange'
#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v
<= _Py_IntegralTypeMax(type))
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymath.h:221:124: note: expanded from macro '_Py_IntegralTypeMax'
#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1
<< (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Python/pytime.c:392:10: warning: implicit conversion from 'long' to 'double'
changes value from 9223372036854775807 to 9223372036854775808
[-Wimplicit-int-float-conversion]
if (!_Py_InIntegralTypeRange(_PyTime_t, d)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymath.h:228:82: note: expanded from macro '_Py_InIntegralTypeRange'
#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v
<= _Py_IntegralTypeMax(type))
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymath.h:221:124: note: expanded from macro '_Py_IntegralTypeMax'
#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1
<< (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
3 warnings generated.
./Modules/timemodule.c:116:13: warning: code will never be executed
[-Wunreachable-code]
PyErr_SetString(PyExc_OverflowError,
^~~~~~~~~~~~~~~
1 warning generated.
./Modules/_threadmodule.c:1587:19: warning: implicit conversion from
'_PyTime_t' (aka 'long') to 'double' changes value from 9223372036854775 to
9223372036854776 [-Wimplicit-int-float-conversion]
timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
^~~~~~~~~~~~~~~~~~~~~~~~~ ~
1 warning generated.
----------
messages: 371714
nosy: christian.heimes, mark.dickinson, p-ganssle
priority: normal
severity: normal
status: open
title: implicit-int-float-conversion warnings in time and math code
type: compile error
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40999>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com