[Patch, fortran] PR31608 - wrong types in character array/scalar binop

Paul Richard Thomas paul.richard.thomas@gmail.com
Thu Oct 18 19:10:00 GMT 2007


:ADDPATCH fortran:

This one turned out to be simple in the end.  The mixing of character
types in assignments came about because gfc_add_modify_expr is just
not equipped to deal with all the wierdness of gfortran's character
representation.  On the otherhand, gfc_trans_scalar_assign has it all
sorted out.  Except for indirect references, which emanate in
profusion from array_constructors, this substitution in
gfc_conv_expr_descriptor works a treat.

The rest of the patch is associated with all the other bits and pieces
that came out of the woodwork in trying to crack the character
casting.  FX did most, if not all of this.:)

The testcase checks for the double reference in the scalarizer, so
that a char is really assigned to an element of char[][] and vice
versa. (Thanks for the help on that, one and all!)

Bootstraps and regtests on x86_ia64/FC5 - OK for trunk? (also does tonto-2.3)

Paul

2007-10-18  Paul Thomas  <pault@gcc.gnu.org>
	    FX Coudert <fxcoudert@gcc.gnu.org>

	PR fortran/31608
	* trans-array.c (gfc_conv_expr_descriptor): For all except
	indirect references, use gfc_trans_scalar_assign instead of
	gfc_add_modify_expr.
	* iresolve.c (check_charlen_present): Separate creation of cl
	if necessary and add code to treat an EXPR_ARRAY.
	(gfc_resolve_char_achar): New function.
	(gfc_resolve_achar, gfc_resolve_char): Call it.
	(gfc_resolve_transfer): If the MOLD expression does not have a
	character length expression, get it from a constant length.

2007-10-18  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31608
	* gfortran.dg/char_cast_1.f90: New test.



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 6424 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071018/63482964/attachment.bin>


More information about the Fortran mailing list