This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/27715] Extented ASCII characters lead to wrong "CASE" selection



------- 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


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