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: 17 Jul 2004 05:04:37 -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-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