This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]