Mail Archives: djgpp/1994/11/10/19:03:10
I think I have found a bug in "isdigit" in GCC for the PC.
The code for isdigit expands in-line as follows:
movsx edx, ... ; Load character in question
mov cl, [edx+...] ; Index into translation table
and cl, 4h ; Check bit 2 is on or off...
... ; (takes several instructions)
The movsx should be movzx. The text we are processing has some
characters in the x80 to xFF range, so the sign-extended move
is causing edx to index *backward* from the start of the table.
Also disturbing me is that I think I also caught Borland TC
doing the same thing. Unfortunately I didn't look at the
generated code (the Borland debugger is deficient in this respect),
but I did observe erratic behavior.
-- Michael Glass | Partnership for a
glass AT steve DOT iit DOT edu | Bug-Free America
- Raw text -