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: 28 May 2006 14:53:30 -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 #2 from tkoenig at gcc dot gnu dot org 2006-05-28 14:53 -------
It's even worse:
$ cat cmp.f
program main
external isgreater
logical isgreater
print *,"a" > "ä"
print *,isgreater("a", "ä")
end
logical function isgreater(s1, s2)
character*1 s1, s2
isgreater = s1 > s2
end
$ gfortran cmp.f
$ ./a.out
T
F
The front end comparison is done using C's native char, whereas
the back end uses strncmp (or memcpy to fix PR 27784, hopefully soon),
which treats chars as unsigned.
Naturally, this leads to breakage when the native char type is signed.
Oh well... this doesn't look too hard to fix. The front end should
use unsigned char.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27715