[Bug fortran/27715] Extented ASCII characters lead to wrong "CASE" selection
tkoenig at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue May 30 19:32:00 GMT 2006
------- Comment #11 from tkoenig at gcc dot gnu dot org 2006-05-30 19:31 -------
Hi FX,
what about
Index: arith.c
===================================================================
--- arith.c (revision 114111)
+++ arith.c (working copy)
@@ -1133,8 +1133,10 @@ gfc_compare_string (gfc_expr * a, gfc_ex
for (i = 0; i < len; i++)
{
- ac = (i < alen) ? a->value.character.string[i] : ' ';
- bc = (i < blen) ? b->value.character.string[i] : ' ';
+ /* We cast to unsigned char because default char, if it is signed,
+ would lead to ac<0 for string[i] > 127. */
+ ac = (unsigned char) ((i < alen) ? a->value.character.string[i] : ' ');
+ bc = (unsigned char) ((i < blen) ? b->value.character.string[i] : ' ');
if (xcoll_table != NULL)
{
?
I've regression-tested this, it does fix the test cases.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27715
More information about the Gcc-bugs
mailing list