[PATCH] strcmp on ARM needs to treat char as unsigned

Jeff Johnston jjohnstn@redhat.com
Tue Mar 24 10:44:00 GMT 2009


Richard Earnshaw wrote:
> On ARM char is unsigned, so strcmp needs to perform the comparison of
> differing chars on that basis, for example (char)0xff > (char)0x01.
> Unfortunately, the tricks I was playing in one of the sub-cases (both
> strings aligned) was slightly too clever and the result was that it
> treated chars as signed, but only if the strings had a mutual common
> alignment.
>
> I have one more patch, for big-endian strcmp (this function has become
> the bane of my life recently), that I'll post shortly.
>
> With acknowledgement to the guys at CodeSourcery, who found this problem
> (and most of the others).
>
> Fixed thus:
>
> 2009-03-23  Richard Earnshaw  <rearnsha@arm.com>
>
> 	* libc/machine/arm/strcmp.c (strcmp): Treat char as unsigned.
>
>
>   
Patch applied.

-- Jeff J.



More information about the Newlib mailing list