This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/gfortran] Partial fix for PR fortran/20879


Steve Kargl wrote:
> The attached patch is a partial fix for fortran/20879.
> I have no idea how to generate the runtime error 
> checking in trans-intrinsic.c(gfc_conv_intrinsic_ichar).
> We need such a check to find problems in programs of
> the form
> 
>    program a
>    integer :: i = 1, j = 2
>    character(len=8) :: c='abcd'
>    i = ichar(c(i:j))  ! Length of c should be 1.
>    end program a
> 
> If anyone can implement the 10 lines of needed code,
> I would be most grateful.  In short, we need to check
> that i and j are equal.

I'll have a look.

> I have bootstrapped, regression tested, and run my
> private Fortran testsuite with this patch.
> 
> OK for mainline?

Not yet, you need to also add this function as a check function for IACHAR as
well.  Alternatively, you could split out the length-one check into a function
of its own and introduce two separate check functions, if at some point we
want to make sure that a constant argument to ICHAR is indeed a character that
is representable by the processor (I assume this only applies to ASCII ->
EBCDIC cross-compilers and the like, so it's not a high priority).

- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]