gcc miscompiles csum_tcpudp_magic() on ARMv5

Måns Rullgård mans at mansr.com
Thu Dec 12 09:47:54 EST 2013


Maxime Bizon <mbizon at freebox.fr> writes:

> On Thu, 2013-12-12 at 14:37 +0000, Måns Rullgård wrote:
>
>> There is no such thing as a 16-bit register on ARM.  What this code does
>> is ask the compiler to take the 16-bit value 'len' and put it in a register
>> for use in the asm code.  All registers are 32-bit, so there is no ambiguity.
>
> which strictly speaking the compiler did ;)
>
> it took the 16 bits value and put it inside the lower 16 bits of the 32
> bits register, it just didn't touch the higher ones

That's not where things went wrong.  The entire computation is done in
registers, and the swab16 macro casts the result to uint16_t.  This cast
should clear the high half of the register (that's the lsl/lsr pair you
saw), but for some reason this isn't happening.

Now please file a gcc bug report.  That's the proper place to be
discussing this.

-- 
Måns Rullgård
mans at mansr.com



More information about the linux-arm-kernel mailing list