[Bug fortran/16579] gfortran: (ICHAR(CHAR(I)) .NE. I) when 128 <= I <= 255
sgk at troutmask dot apl dot washington dot edu
gcc-bugzilla@gcc.gnu.org
Sat Jul 17 05:04:00 GMT 2004
------- Additional Comments From sgk at troutmask dot apl dot washington dot edu 2004-07-17 05:04 -------
I went looking for the bug and have a lead. In simplify.c we
have hard code numbers of 0 and 255 for CHAR() while we use
CHAR_MIN and CHAR_MAX from /usr/include/limits.h in ICHAR().
On FreeBSD (and suspect other systems), CHAR_MIN and CHAR_MAX
range from -128 to 127. I haven't determined the correct fix
yet, but I believe we need to change line 1329--1331 from
index = (int) e->value.character.string[0];
if (index < CHAR_MIN || index > CHAR_MAX)
to
index = (int) ((unsigned int) e->value.character.string[0]);
if (index < 0 || index > 255)
Although I hate hard coded numbers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16579
More information about the Gcc-bugs
mailing list