Open KitHubek opened 3 weeks ago
Got the same. However, from my 7 devices only on those with platform nodemcuv2
which are 8266. On various ESP32 devices not
Same issue here. Default Bluetooth Proxy board: m5stack-atom framework_type: esp-idf
Compiling .pioenvs/bt-proxy/src/esphome/core/component.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); } ^~~~~~~~~~~~~~~~~~~ Compiling .pioenvs/bt-proxy/src/esphome/core/component_iterator.o
Another device with same board but farmework_type: arduino did not have the warning.
Getting this with the default Bluetooth proxy code as well..
Same for me with olimex-bluetooth-proxy and atom-bluetooth-proxy
Same thing here except for ESP32 devices
Same thing occurring while updating Everything Presence Lite.
Same here. After update Core 2024.8.1 -> 2024.8.2 and HAOS 13.0 -> 13.1 (but there was no ESPHome update - it's still 2024.8.0), after reboot there was new update of all ESP8266 devices (GoSund P1 & GoSund SP111), same warnings. Also update done with SUCCESS.
It's just a warning. It will still work and the warning will get fixed at some point.
It's just a warning. It will still work and the warning will get fixed at some point.
Yes, it will (most probably, but not guaranteed) work, however casting errors/warnings are often exploited. So for security reasons, it would be good to have it fixed ASAP.
EDIT: search fu left me hanging here. Not the same issue I have, sorry!
I've experienced this problem and it did break the application - the device became unresponsive. Sorry, I didn't capture the decode section before rolling back.
I get the same warning, Core: 2024.8.2 HAOS: 13.1 ESPHome: 2024.8.0
esp32: board: esp32dev framework: type: esp-idf version: recommended
compile log:
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); }
^~~~~~~
So for security reasons, it would be good to have it fixed ASAP.
You can be assured there is no security risk - the warning is spurious, in the sense that the code is actually perfectly fine, just the linter doesn't have enough context to determine that. And that piece of code isn't at this time actually used anywhere. But it will be fixed for all the obvious reasons.
Fixed with https://github.com/esphome/esphome/pull/7316
This is still present in 2024.8.1
It's only in dev, so will be in the next full release. I don't know if it will get pulled into a point release before that.
I've the same warning in my esp8266 gas sensor. Everything works correctly but warning is still there Could you explain me the meaning? thanx
The compiler doesn't like casting a float pointer to an int pointer like that.
casting a float pointer to an int pointer
the compiler might think about doing the compiler's job without making judgments or having preferences ;)
ESPHome 2024.8.3 ESP8266
Compiling .pioenvs/pzem1/src/esphome/core/bytebuffer.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); }
| ^~~~~~~~~~~~~~~~~~~
It will be fixed in the next major release. There's no need to keep commenting about it. I'm only leaving this open so that people can find it and hopefully not create new issues.
The problem
Updating device to newest 2024.8.0 and see this error/warning at log during update process. Update done with SUCCES mark
Which version of ESPHome has the issue?
2024.8.0
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2024.8.2
What platform are you using?
ESP32
Board
esp32dev and esp32doit-devkit-v1 (wt32-eth01)
Component causing the issue
dont know
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response