[Patch, fortran] PR31879 , PR31197 , PR31258 & PR32703 - various character problems

Paul Thomas paulthomas2@wanadoo.fr
Wed Aug 29 20:06:00 GMT 2007


:ADDPATCH fortran:

This patch removes some kludges for character expressions from 
translation and adds a comprehensive fix for the remaining character 
problems to resolution.  The latter, in principle, ensures that a 
character expression also has a character length expression.  These are 
then translated using gfc_trans_init_string_length, which has been 
renamed to gfc_conv_string_length, both to reflect the convention 
described in trans.c and its more general use.

The development relative to the version of 20070615 is that the final 
test in character_length_7.f90 is fixed and the extraneous code removed 
from trans-array.c and trans-expr.c.

I am certain that were I to say that this is an end to this kind of bug, 
all hell would break loose :-)   However, the patch is a step in that 
direction......

The testcases are based on the reporters'.

Bootstrapped and regtested on x86_ia64/FC5 - OK for trunk?

Paul

2007-08-29  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/31879
    PR fortran/31197
    PR fortran/31258
    PR fortran/32703
    * gfortran.h : Add prototype for gfc_resolve_substring_charlen.
    * resolve.c (gfc_resolve_substring_charlen): New function.
    (resolve_ref): Call gfc_resolve_substring_charlen.
    (gfc_resolve_character_operator): New function.
    (gfc_resolve_expr): Call the new functions in cases where the
    character length is missing.
    * iresolve.c (cshift, eoshift, merge, pack, reshape, spread,
    transpose, unpack): Call gfc_resolve_substring_charlen for
    source expressions that are character and have a reference.
    * trans.h (gfc_trans_init_string_length) Change name to
    gfc_conv_string_length; modify references in trans-expr.c,
    trans-array.c and trans-decl.c.
    * trans-expr.c (gfc_trans_string_length): Handle case of no
    backend_decl.
    (gfc_conv_aliased_arg): Remove code for treating substrings
    and replace with call to gfc_trans_string_length.
    * trans-array.c (gfc_conv_expr_descriptor): Remove code for
    treating strings and call gfc_trans_string_length instead.

2007-08-29  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/31879
    * gfortran.dg/char_length_7.f90: New test.
    * gfortran.dg/char_assign_1.f90: Add extra warning.

    PR fortran/31197
    PR fortran/31258
    * gfortran.dg/char_length_8.f90: New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 24435 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070829/49cd7754/attachment.bin>


More information about the Fortran mailing list