According to the Fortran 95 standard, the result of ACHAR(I) for I not in the
range of 0 to 127 is "processor-dependent".  This implies that it _has_ a
result, and thus that it is legal code.  However, consider the following
result:

------------------------------------------------------------------------
debian-gfortran:~/test> cat achar.f90
write(*,*) achar(154)
end

debian-gfortran:~/test> ../bin-trunk/bin/gfortran achar.f90
achar.f90:1.17:

write(*,*) achar(154)
                1
Error: Extended ASCII not implemented: argument of ACHAR at (1) must be between
0 and 127
------------------------------------------------------------------------

This error is erroneous, and should be removed and a valid result of some sort
should be substituted.

(I will further note that this is inconsistent with what happens when the
ACHAR() call is not constant-folded.  It appears that, when the call is not
constant-folded, the result is simply that the least-significant 8 bits of I
are copied into the character.)


-- 
           Summary: ACHAR() intrinsic gives erroneous errors in constant-
                    folding.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brooks at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30389

Reply via email to