2006-06-01 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/27715
* arith.c: Cast the characters from the strings to unsigned
char to avoid values less than 0 for extended ASCII.
2006-06-01 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/27715
* gfortran.dg/extended_char_comparison_1.f: New test.
From-SVN: r114317
+2006-06-01 Thomas Koenig <Thomas.Koenig@online.de>
+
+ PR fortran/27715
+ * arith.c: Cast the characters from the strings to unsigned
+ char to avoid values less than 0 for extended ASCII.
+
2006-06-01 Per Bothner <bothner@bothner.com>
* data.c (gfc_assign_data_value): Handle USE_MAPPED_LOCATION.
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)
{
+2006-06-01 Thomas Koenig <Thomas.Koenig@online.de>
+
+ PR fortran/27715
+ * gfortran.dg/extended_char_comparison_1.f: New test.
+
2006-06-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25098
--- /dev/null
+! { dg-do run }
+! PR 27715 - the front end and the library used to have different ideas
+! about ordering for characters whose encoding is above 127.
+
+ program main
+ character*1 c1, c2
+ logical a1, a2
+ c1 = 'ç';
+ c2 = 'c';
+ a1 = c1 > c2;
+ call setval(c1, c2)
+ a2 = c1 > c2
+ if (a1 .neqv. a2) call abort
+ end
+
+ subroutine setval(c1, c2)
+ character*1 c1, c2
+ c1 = 'ç';
+ c2 = 'c';
+ end