public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216 and 67674
@ 2015-11-09 13:38 Paul Richard Thomas
  2015-11-09 14:46 ` Steve Kargl
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Richard Thomas @ 2015-11-09 13:38 UTC (permalink / raw)
  To: fortran; +Cc: Dominique Dhumieres, Damian Rouson, Louis Krupp

Dear All,

Spurred by a clf thread, I have made a start on deferred length
character bugs. The meta-bug  was posted by Dominique, for which
thanks.

The change to trans-array.c is done to ensure that gfc_build_array_ref
has the DECL_CONTEXT of the symbol to compare with that of the
deferred string length variable.

That is trans-stmt.c provides the deferred string length variable for
allocations, where an explicit typespec is used. This ensures that the
dtype of the allocated array descriptor has the correct size.

The trans-types.c and trans.c modifications are sufficiently described
in the ChangeLog below.

Boostraps and regtests on FC21/x86_64 - OK for trunk?

There seems to be some irritation out in the field that gfortran's
handling of deferred length characters is not in very good shape. The
attached patch will need some adaptation to work with 4.9 and 5
branches. However, I think that it is worthwhile to do this because
the distros will not include 6 branch for quite a long time. I will
submit the patch(es) for 4.9 and 5 separately.

Louis Krupp is looking at PR49954 (ICE assigning concat expression to
an array deferred-length string (realloc on assignment)), which is a
really unpleasant bug that winds up putting code using temporary
variables before their decalarations, thereby mightily upsetting the
gimplifier. By the way, Louis, The assignment should be generating a
temporary, I think. I do not see any sign of that in the code :-(

Cheers

Paul

2015-11-09  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/50221
    PR fortran/68216
    * trans_array.c (gfc_conv_scalarized_array_ref): Pass the
    symbol decl for deferred character length array references.
    * trans-stmt.c (gfc_trans_allocate): Keep the string lengths
    to update deferred length character string lengths.
    * trans-types.c (gfc_get_dtype_rank_type); Use the string
    length of deferred character types for the dtype size.
    * trans.c (gfc_build_array_ref): For references to deferred
    character arrays, use the domain max value, if it is a variable
    to set the 'span' and use pointer arithmetic for access to the
    element.
    (trans_code): Set gfc_current_locus for diagnostic purposes.

    PR fortran/67674
    * trans-expr.c (gfc_conv_procedure_call): Do not fix deferred
    string lengths of component references.

2015-11-09  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/50221
    * gfortran.dg/deferred_character_1.f90: New test.

    PR fortran/68216
    * gfortran.dg/deferred_character_2.f90: New test.

    PR fortran/67674
    * gfortran.dg/deferred_character_3.f90: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-13 15:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 13:38 [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216 and 67674 Paul Richard Thomas
2015-11-09 14:46 ` Steve Kargl
2015-11-10  9:48   ` Paul Richard Thomas
2015-11-10 15:39     ` Dominique d'Humières
2015-11-12 13:14       ` Paul Richard Thomas
2015-11-12 18:56         ` Dominique d'Humières
2015-11-13 14:16           ` Dominique d'Humières
2015-11-13 15:32             ` Dominique d'Humières

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).