https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112409

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Frediano Ziglio from comment #0)
> static unsigned
> cksum(const void *pkt, size_t len, unsigned int start)
> {
>       const uint16_t *data = (const uint16_t *) pkt;
>       unsigned sum = start;
> 
>       for (; len >= 2; len -= 2)
>               sum += *data++;

Right, this is undefined behaviour, because you're reading uint16_t values from
an object that is not a uint16_t.

Reply via email to