Since ESPHome version 2024.8.0 (also happening with 2024.8.1) I am getting a compilation warning for the newly introduced bytebuffer
component when updating all of my ESP8266 devices:
Compiling .pioenvs/d1v3-02/src/esphome/core/application.cpp.o
Compiling .pioenvs/d1v3-02/src/esphome/core/bytebuffer.cpp.o
Compiling .pioenvs/d1v3-02/src/esphome/core/color.cpp.o
src/esphome/core/bytebuffer.cpp: In member function 'float esphome::ByteBuffer::get_float()':
src/esphome/core/bytebuffer.cpp:86:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
86 | return *(float *) &value;
| ^~~~~~~~~~~~~~~~
src/esphome/core/bytebuffer.cpp: In member function 'void esphome::ByteBuffer::put_float(float)':
src/esphome/core/bytebuffer.cpp:129:61: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
129 | void ByteBuffer::put_float(float value) { this->put_uint32(*(uint32_t *) &value); }
| ^~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/d1v3-02/src/esphome/core/component.cpp.o
Compiling .pioenvs/d1v3-02/src/esphome/core/component_iterator.cpp.o
This does not happen with ESP32 devices.
The compilations finish OK, and I don’t see any bad effects from this, so it appears to be just a harmless warning, but for me it is a rather cryptic warning.
Is this indeed harmless and can it be ignored?
Is anybody else seeing this as well?