On 07/06/17 14:45, K wrote: > And I found that that a version which I beleve mustn't have aliasing > problems still generates same warnings.
It still has aliasing problems: you can't make them magically go away by using an intermediate uint8_t*. You're doing this: struct udp_pseudo { uint32_t src; uint32_t dst; uint8_t z; uint8_t proto; uint16_t len; } tmp; ... auto ret = calc_16bit_checksum_part((uint8_t*)&tmp, sizeof(tmp), 0); static uint32_t calc_16bit_checksum_part(uint8_t* buf, int len, uint32_t ret) { struct ui16{ uint16_t d; }; ui16 *ptr = (ui16*)buf; There's no need for any of this messing about with pointer casts, as has been explained. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671