This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/16579] gfortran: (ICHAR(CHAR(I)) .NE. I) when 128 <= I <= 255
- From: "sgk at troutmask dot apl dot washington dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2004 04:24:21 -0000
- Subject: [Bug fortran/16579] gfortran: (ICHAR(CHAR(I)) .NE. I) when 128 <= I <= 255
- References: <20040716002516.16579.billingd@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From sgk at troutmask dot apl dot washington dot edu 2004-07-16 04:24 -------
The standard says that the range for I in CHAR(I) "shall be of type integer
with a value in the range [0, n - 1], where n is the number of characters
in the collating sequence associated with the specified kind type parameter."
Gfortran uses the ASCII collating sequence, which has 128 characters. The
standard does not specify the return value of CHAR(I) when I is not in the
specified range. So, this isn't a signed versus an unsigned problem. It
falls under the heading "processor defined behavior". Personally, I think
CHAR() and ICHAR() should do the appropriate range check and issues an
error for out of range values.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16579