Bug 52730

Summary: Ichar is wrong
Product: [Retired] Red Hat Linux Reporter: Need Real Name <bjorn.elstad>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED DUPLICATE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-28 14:50:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

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
                 end
2.
Compile and run

     make abc
     abc

3.
	

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