This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/27715] Extented ASCII characters lead to wrong "CASE" selection
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 May 2006 19:31:55 -0000
- Subject: [Bug fortran/27715] Extented ASCII characters lead to wrong "CASE" selection
- References: <bug-27715-10601@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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