This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/gfortran] Partial fix for PR fortran/20879
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 24 Apr 2005 15:47:32 +0200
- Subject: Re: [PATCH/gfortran] Partial fix for PR fortran/20879
- References: <20050424035657.GA90957@troutmask.apl.washington.edu>
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