Red Hat Bugzilla – Bug 52730
Ichar is wrong
Last modified: 2007-04-18 12:36:40 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
Description of problem: gcc includes g77. In version 2.96
g77 (f77) intrinsic ICHAR returns an integer -128 < Ichar < 127.
According to an gcc specialist, this is not neccessary in conflict
with the stanardisation statements, but it is contrary to earlier
function of g77 (f77), 0 <= Ichar < 256.
The change is undone in next version of gcc (g77), namely 3.01.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Make fortran program using Ichar, example the following that
can be stored to a file abc.f
implicit integer (a-z)
do 200 ix = 1, len(istring), 1
write (*,*) istring(ix:ix),":",
- ichar (istring(ix:ix))
Compile and run
The characters C&C8C%CCC are given negative integer values.
Expected Results: The characters C&C8C%CCC should be given positive
integer values in the range 128 ... 255.
All old fortran programs using ichar to parse
character strings, outside 7-bit ascii, will crash or
give wrong results.
(Note, this form seems also to have problems with
characters outside 7-bit ascii ...)
*** This bug has been marked as a duplicate of 42281 ***