Dereferencing type-punned pointer will break strict-aliasing rules

How I can report this?

Compiling .pioenvs/test/src/esphome/core/color.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]
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]
void ByteBuffer::put_float(float value) { this->put_uint32(
(uint32_t *) &value); }

1 Like