[bitc-dev] bug in character decode routines
Sam Mason
sam at samason.me.uk
Mon May 15 14:14:00 EDT 2006
Hi,
Another little buglet -- this time in the character decoding routines!
If you enter a character literal like #\a it will be decoded as some
random value (``codePoint'' in LitValue::DecodeRawCharacter() never
appears to get initialised to anything in this case).
As far as I can tell (a couple of the unit tests seem to confirm it)
this is how I would write the single character `a' and I'm not expected
to write #\{U+61}. Even if you are, I don't think the computer should
be writing out random values from uninitialised variables.
Sam
-------------- next part --------------
--- src.coyotos/src/ccs/bitcc-bootstrap/frontend/LitValue.cxx 2006-05-15 19:13:06.000000000 +0100
+++ src.coyotos/src/ccs/bitcc-bootstrap/frontend/LitValue.cxx 2006-05-15 19:13:07.000000000 +0100
@@ -267,6 +267,10 @@
else if (strcmp(s, "rbrace") == 0) {
codePoint = '}';
s += 6;
+ } else {
+ /* finally, if it's not one of those, just treat it as a single
+ * character */
+ codePoint = *s++;
}
}
More information about the bitc-dev
mailing list