public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: Tobias Burnus <burnus@net-b.de>
Cc: Jakub Jelinek <jakub@redhat.com>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: [Patch, Fortran] PR fortran/83522 – reject array-valued substrings
Date: Thu, 11 Oct 2018 19:40:00 -0000	[thread overview]
Message-ID: <CAGkQGiKd0WJ8qqEHQczzPS_-ABBCsZA3c2i=xN=L9O-kPFmzsA@mail.gmail.com> (raw)
In-Reply-To: <ea3f8df8-ab6c-4965-f645-820b9149a24a@net-b.de>

Hi Tobias,

I am sorry that your return has proven to be a bit bloody. Thanks for
reverting it. I am afraid that Jerry missed the context completely.

Regards

Paul

On Thu, 11 Oct 2018 at 20:37, Tobias Burnus <burnus@net-b.de> wrote:
>
> In light of the somehow missed test-suite fails and the discussion about
> rejecting too much, I have reverted the patch with commit r83522.
>
> Tobias
>
> Am 11.10.18 um 12:46 schrieb Jakub Jelinek:
> > On Mon, Oct 08, 2018 at 09:44:57PM +0200, Tobias Burnus wrote:
> >> as the PR (and the attached testcase) shows, gfortran doesn't handle
> >> noncontiguous access with substrings. Namely, "str_array(:)(1:5)" is
> >> mishandled (segfault while building the "tree" as expr == NULL).
> >>
> >> As Jerry has dug up in the standard (F2008, R610 alias F2018, R908),
> >> substrings are only permitted on scalars (or array elements). – [gfortran
> >> has some partial support for noncontiguous memory as actual argument the now
> >> rejected test cases show.]
> >>
> >> In words of the standard (here: F2018):
> >>
> >> 9.4.1  Substrings
> >>
> >> A substring is a contiguous portion of a character string (7.4.4).
> >>
> >> R908   substring   is   parent-string  ( substring-range )
> >>
> >> R909   parent-string
> >>              is   scalar-variable-name
> >>              or  array-element
> >>              or  coindexed-named-object
> >>              or  scalar-structure-component
> >>              or  scalar-constant
> >>
> >> The patch adds a check to the variable resolving – it comes too late to
> >> print a nice error message for "string(:)(:)"; that statement gets matched
> >> unsuccessfully and at the end the buffered error message of match_variable
> >> (unexpected character "(") gets printed. – One could reject it earlier but
> >> the code doesn't seem to be that nice. (See PR for a variant.)
> >>
> >> Build and regtested on x86_64-linux.
> >> OK for the trunk?
> > As I wrote in the PR, I believe it is incorrect and should be reverted.
> > While for
> >    character(kind=1,length=4) :: f(4,5)
> > e.g.
> >    f(:,:)(1:2)
> > is not matching the substring non-terminal, it is IMNSHO matching the
> > array-section non-terminal:
> > R918   array-section
> >              is data-ref [ ( substring-range ) ]
> >              or complex-part-designator
> > C925   (R918) Exactly one part-ref shall have nonzero rank, and either the final
> >             part-ref shall have a section-subscript-list with nonzero rank, another
> >             part-ref shall have nonzero rank, or the complex-part-designator
> >             shall be an array.
> > C926   (R918) If a substring-range appears, the rightmost part-name shall be of type
> >             character.
> > and in that case:
> >
> > An array element is a scalar. An array section is an array. If a substring-range
> > appears in an array-section, each element is the designated substring of the
> > corresponding element of the array section.
> >
> > applies.
> >
> >       Jakub



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein

      reply	other threads:[~2018-10-11 19:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 19:45 Tobias Burnus
2018-10-08 22:15 ` Thomas Koenig
2018-10-10 23:12   ` Paul Richard Thomas
2018-10-11 13:56     ` David Edelsohn
2018-10-11 14:20     ` David Edelsohn
2018-10-11 14:39       ` Paul Richard Thomas
2018-10-11 10:46 ` Jakub Jelinek
2018-10-11 19:37   ` Tobias Burnus
2018-10-11 19:40     ` 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='CAGkQGiKd0WJ8qqEHQczzPS_-ABBCsZA3c2i=xN=L9O-kPFmzsA@mail.gmail.com' \
    --to=paul.richard.thomas@gmail.com \
    --cc=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /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).