On 07/06/17 10:15, Kirill Yu Berezin wrote: > My question is. Is this an expected behaviour or I must report a bug ?
It's not a bug: your code displays undefined behaviour: you're casting a pointer to struct udp_pseudo fields to an array of uint16_t. This is never well-defined in C++, but if you really want to do this kind of thing, use -fno-strict-aliasing. See also http://www.microhowto.info/howto/calculate_an_internet_protocol_checksum_in_c.html -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671