[Bug fortran/16579] gfortran: (ICHAR(CHAR(I)) .NE. I) when 128 <= I <= 255
Toon Moene
toon@moene.indiv.nluug.nl
Fri Jul 16 20:54:00 GMT 2004
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,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/
More information about the Gcc-bugs
mailing list