On Mon, Nov 27, 2017 at 10:02:53PM -0300, Juan Cabrera wrote: > int read(const void* buffer) > { > int r; > std::memcpy(&r, buffer, 1); > // std::memcpy(&r, buffer, sizeof(r)); > return r; > } This is undefined behaviour (you are returning uninitialised data). Try with int r = 0; instead? (It is still not portable then, but at least not undefined behaviour anymore). > Do you think there's a reason for this or is this just an optimizer bug? We do not care too much about generating efficient binary code for incorrect source code ;-) Segher