Bug 52730 - Ichar is wrong
Ichar is wrong
Status: CLOSED DUPLICATE of bug 42281
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-08-28 10:50 EDT by Need Real Name
Modified: 2007-04-18 12:36 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-08-28 10:50:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-08-28 10:50:00 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):

How reproducible:

Steps to Reproduce:
1. Make fortran program using Ichar, example the following that
can be stored to a file abc.f

                 program abc
                 implicit integer (a-z)
                 character*(*) istring
                 parameter (istring="abcC&C8C%ABCCCC")
                 do 200 ix = 1, len(istring), 1
                   write (*,*) istring(ix:ix),":",
      -                ichar (istring(ix:ix))
200              continue
Compile and run

     make abc


Actual Results:  
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.

Additional info:

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 ...)
Comment 1 Jakub Jelinek 2001-08-28 11:03:43 EDT

*** This bug has been marked as a duplicate of 42281 ***

Note You need to log in before you can comment on or make changes to this bug.