This is the reason that you are not allowed to alias a variable with another type (can be disabled using -fno-strict-aliasing) [1].
However, one of exceptions is char and std::byte. The compiler is not allowed to assume that a write to char& won’t affect the value of a double& for example [2].
[1]: https://www.gnu.org/software/c-intro-and-ref/manual/html_nod...
[2]: https://en.cppreference.com/w/cpp/language/reinterpret_cast....