This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/16579] gfortran: (ICHAR(CHAR(I)) .NE. I) when 128 <= I <= 255


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]