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: "toon at moene dot indiv dot nluug dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2004 20:54:17 -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 toon at moene dot indiv dot nluug dot nl 2004-07-16 20:54 -------
Subject: Re: gfortran: (ICHAR(CHAR(I)) .NE. I) when 128
<= I <= 255
sgk at troutmask dot apl dot washington dot edu wrote:
> ------- 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.
I think it would be more useful to just allow the range 0..255 for the
return value of ICHAR. Too many codes depend on it.
I fixed this in 3.1 or 3.2 for g77 (when it suddenly went to -128 .. 127.
Cheers,
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16579