NRF52: build error, implicit conversion from 'float' to 'double'
Port, board and/or hardware
nrf port, nrf52 board
MicroPython version
mpy latest, nrf52 board
The build process has failed with a compiler configuration issue if support for double is configured.
Build error report:
CC ../../py/formatfloat.c
../../py/formatfloat.c: In function 'mp_format_float':
../../py/formatfloat.c:92:26: error: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Werror=double-promotion]
92 | #define fp_isless1(x) (x < 1.0)
| ^
../../py/formatfloat.c:183:16: note: in expansion of macro 'fp_isless1'
183 | } else if (fp_isless1(f)) {
| ^~~~~~~~~~
../../py/formatfloat.c:336:15: error: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Werror=double-promotion]
336 | f *= FPCONST(10.0);
| ^~
cc1: all warnings being treated as errors
Reproduction
mpconfigport.h
#if NRF51
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
#else
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#endif
Expected behaviour
No response
Observed behaviour
Related build error report.
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
1.13+ doesn't compile on FreeBSD 13.0
Starting with micropython 1.13 I cannot compile it on FreeBSD 13 anymore. 1.12 worked fine. Installation methods were installation via pyenv's python-build, as well as the ports/unix method described in the README.
[...]
CC ../../py/formatfloat.c
In file included from ../../py/formatfloat.c:33:
../../py/formatfloat.c: In function 'mp_format_float':
../../py/formatfloat.c:131:20: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
131 | if (fp_signbit(f) && !fp_isnan(f)) {
| ^
../../py/formatfloat.c:131:9: note: in expansion of macro 'fp_signbit'
131 | if (fp_signbit(f) && !fp_isnan(f)) {
| ^~~~~~~~~~
../../py/formatfloat.c:131:36: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
131 | if (fp_signbit(f) && !fp_isnan(f)) {
| ^
../../py/formatfloat.c:131:27: note: in expansion of macro 'fp_isnan'
131 | if (fp_signbit(f) && !fp_isnan(f)) {
| ^~~~~~~~
../../py/formatfloat.c:146:22: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
146 | if (fp_isinf(f)) {
| ^
../../py/formatfloat.c:146:13: note: in expansion of macro 'fp_isinf'
146 | if (fp_isinf(f)) {
| ^~~~~~~~
../../py/formatfloat.c:151:29: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
151 | } else if (fp_isnan(f)) {
| ^
../../py/formatfloat.c:151:20: note: in expansion of macro 'fp_isnan'
151 | } else if (fp_isnan(f)) {
| ^~~~~~~~
cc1: all warnings being treated as errors
gmake: *** [../../py/mkrules.mk:77: build-standard/py/formatfloat.o] Error 1