Bug 52730 - Ichar is wrong
Summary: Ichar is wrong
Status: CLOSED DUPLICATE of bug 42281
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-08-28 14:50 UTC by Need Real Name
Modified: 2007-04-18 16:36 UTC (History)
0 users

Clone Of:
Last Closed: 2001-08-28 14:50:05 UTC

Attachments (Terms of Use)

Description Need Real Name 2001-08-28 14:50:00 UTC
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 15:03:43 UTC

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