[Patch, fortran] PR29912 - string array functions behaving incorrectly.

Paul Thomas paulthomas2@wanadoo.fr
Wed Nov 22 14:18:00 GMT 2006


:ADDPATCH fortran:

This patch and its testcase are reasonably self-explanatory.  An 
assignment from a character array valued function would cause a segfault 
if the function character length were greater than that of the lhs.  
Andrew Pinski spotted immediately that the the function call should be 
producing a temporary, so that the scalarizer could transfer the 
truncated strings to the destination.  The problem has been remedied by 
producing the temporary unless the lhs and the character array valued 
function both have the same, constant character length.  The testcase is 
that of the reporter.

Regtested on Cygwin_NT/amd64  - OK for trunk, 4.2 and 4.1?

Paul

2006-11-22 Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/29912
    * trans-expr.c (gfc_trans_arrayfunc_assign): Return NULL if the
    lhs and rhs character lengths are not constant and equal for
    character array valued functions.

2006-11-22 Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/29912
    * gfortran.dg/char_result_12.f90: New test.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr29912.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061122/d1a71206/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Change.Logs
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061122/d1a71206/attachment-0001.ksh>


More information about the Fortran mailing list