public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Steve Kargl <sgk@troutmask.apl.washington.edu>,
		Damian Rouson <damian@sourceryinstitute.org>,
	Dominique Dhumieres <dominiq@lps.ens.fr>
Subject: Re: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs49630, 54070, 60593, 60795, 61147, 63232 and 64324
Date: Fri, 15 Jan 2016 20:44:00 -0000	[thread overview]
Message-ID: <CAGkQGi+KtPMeqyDW4X01nB1RNjTnA9AQARG_3CbTA+H-35jXAg@mail.gmail.com> (raw)
In-Reply-To: <CAGkQGiKpX9gia3a2e_Aq7-wOPahmpjU=E4N8UZr=VOvnibS2Yg@mail.gmail.com>

Dear All,

Following an exchange with Dominique on #gfortran, I fixed PR54070
comment #23. The changes are in trans-array.c and are listed in the
ChangeLogs below.

Committed to trunk as revision 232450. I will wait some weeks before
committing to 5-branch. This patch should have made deferred character
length a rather more usable feature. They still don't work in common
blocks (PR55735) and there are still problems with them as associate
variables (PR60458). I will endeavour to fix these PRs next.

Thanks, Dominique!

Paul

On 9 January 2016 at 20:33, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
> Dear All,
>
> This is a further instalment of deferred character length fixes. I
> have listed the status of all the deferred length PRs that I know of
> in an attachment. As far as I can see, there are five left that are
> really concerned with deferred character length functionality.
>
> In terms of the number of PRs fixed, this patch is rather less
> impressive than it looks. Essentially four things have been fixed:
> (i) Deferred character length results are passed by reference and so,
> within the procedure itself, they are consistently indirectly
> referenced;
> (ii) The deferred character types are made correctly by indirectly
> referencing the character length;
> (iii) Array references to deferred character arrays use pointer arithmetic; and
> (iv) Scalar assignments to unallocated arrays are trapped at runtime
> with -fcheck=mem.
>
> A minor tweak was required to fix PR64324 because deferred length
> characters were being misidentified as assumed length.
>
> The ChangeLog is clear as to what has been done. The only point on
> which I am uncertain is that of making the length parameter of
> deferred character length procedure results TREE_STATIC. This was
> required to make the patch function correctly at any level of
> optimization. Is this the best and/or only way of doing this?
>
> Bootstrapped and regtested on FC21/x86_64 - OK for trunk and, after a
> decent interval, 5 branch?
>
> Cheers
>
> Paul
>
> 2016-01-09  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/64324
>     * resolve.c (check_uop_procedure): Prevent deferred length
>     characters from being trapped by assumed length error.
>
>     PR fortran/49630
>     PR fortran/54070
>     PR fortran/60593
>     PR fortran/60795
>     PR fortran/61147
>     PR fortran/64324
>     * trans-array.c (gfc_conv_scalarized_array_ref): Pass decl for
>     function as well as variable expressions.
>     * trans.c (gfc_build_array_ref): Expand logic for setting span
>     to include indirect references to character lengths.
>     * trans-decl.c (gfc_get_symbol_decl): Ensure that deferred
>     result char lengths that are PARM_DECLs are indirectly
>     referenced both for directly passed and by reference.
>     (create_function_arglist): If the length type is a pointer type
>     then store the length as the 'passed_length' and make the char
>     length an indirect reference to it.
>     (gfc_trans_deferred_vars): If a character length has escaped
>     being set as an indirect reference, return it via the 'passed
>     length'.
>     * trans-expr.c (gfc_conv_procedure_call): The length of
>     deferred character length results is set TREE_STATIC and set to
>     zero.
>     (gfc_trans_assignment_1): Do not fix the rse string_length if
>     it is a variable, a parameter or an indirect reference. Add the
>     code to trap assignment of scalars to unallocated arrays.
>     * trans-stmt.c (gfc_trans_allocate): Remove 'def_str_len' and
>     all references to it. Instead, replicate the code to obtain a
>     explicitly defined string length and provide a value before
>     array allocation so that the dtype is correctly set.
>     trans-types.c (gfc_get_character_type): If the character length
>     is a pointer, use the indirect reference.
>
> 2016-01-09  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/49630
>     * gfortran.dg/deferred_character_13.f90: New test for the fix
>     of comment 3 of the PR.
>
>     PR fortran/54070
>     * gfortran.dg/deferred_character_8.f90: New test
>     * gfortran.dg/allocate_error_5.f90: New test
>
>     PR fortran/60593
>     * gfortran.dg/deferred_character_10.f90: New test
>
>     PR fortran/60795
>     * gfortran.dg/deferred_character_14.f90: New test
>
>     PR fortran/61147
>     * gfortran.dg/deferred_character_11.f90: New test
>
>     PR fortran/64324
>     * gfortran.dg/deferred_character_9.f90: New test



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein

      reply	other threads:[~2016-01-15 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09 19:33 Paul Richard Thomas
2016-01-15 20:44 ` Paul Richard Thomas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGkQGi+KtPMeqyDW4X01nB1RNjTnA9AQARG_3CbTA+H-35jXAg@mail.gmail.com \
    --to=paul.richard.thomas@gmail.com \
    --cc=damian@sourceryinstitute.org \
    --cc=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sgk@troutmask.apl.washington.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).