ESPHome ESP8266 compilation warning for bytebuffer component since version 2024.8.0

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?

It’s harmless, already fixed in the dev branch, the fix will be in the next release. It does show up only in some builds.

2 Likes

Thanks Clyde, that’s reassuring.

This is still happening with the latest version 2024.8.3

It will be fixed in the next major release, so version 2024.9
See: Warning at log when update device from 2024.7.3 to 2024.8.0 · Issue #6179 · esphome/issues · GitHub