public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: "Dominique d'Humières" <dominiq@lps.ens.fr>
Cc: gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, fortran] PR82173 (PDT) - [meta-bug] Parameterized derived type errors
Date: Tue, 12 Sep 2017 17:28:00 -0000	[thread overview]
Message-ID: <CAGkQGiLahMoH4VLtd8jjQwnjg5aSiHm2gBVOATQa-V2ZK0z3Lg@mail.gmail.com> (raw)
In-Reply-To: <660B8858-CBC0-4107-9274-9874DD354EE8@lps.ens.fr>

Dear Dominique,

That error is perfectly correct. Change the order of the assignment
and the declaration for 'b' and you will see that all is well.

The matching of type parameter specification list follows the same
rules as those of actual arguments, except that deferred and assumed
expressions are allowed for PDTs.

I am not convinced that I have deferred and assumed parameters fully
sorted out yet. I suspect that I am too permissive. On the other hand
entities declared in a module do not make any sense unless (i) All the
LEN parameters are deferred; or (ii) The default initialization is
somehow able to deal with variables in the specification expressions.
I will have to ask one of the gurus how to do this.

Cheers

Paul


On 12 September 2017 at 13:47, Dominique d'Humières <dominiq@lps.ens.fr> wrote:
> Dear Paul,
>
> I have been playing with the patch and found that the following variant of the test for pr82168
>
> module mod
> implicit none
>
> integer, parameter :: dp = kind (0.0d0)
>
> type, public :: v(z, k)
>    integer, len :: z
>    integer, kind :: k = kind(0.0)
>    real(kind = k) :: e(z)
> end type v
>
> end module mod
>
> program bug
> use mod
> implicit none
>
> type (v(2)) :: a
> a%e = 1.0
> type (v(z=:, k=dp)) :: b
>
> end program bug
>
> gives the error
>
> pr82168_db_1.f90:23:24:
>
>  type (v(z=:, k=dp)) :: b
>                         1
> Error: Unexpected data declaration statement at (1)
>
> I am also puzzled by the meaning of ‘z=:’ in the main program. Should not it be restricted to be inside a procedure?
>
> Cheers,
>
> Dominique
>
>



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

  reply	other threads:[~2017-09-12 17:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 12:47 Dominique d'Humières
2017-09-12 17:28 ` Paul Richard Thomas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-11 19:16 Paul Richard Thomas
2017-09-11 19:50 ` Janus Weil
2017-09-12  7:08   ` Paul Richard Thomas
2017-09-12 18:16   ` Paul Richard Thomas

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=CAGkQGiLahMoH4VLtd8jjQwnjg5aSiHm2gBVOATQa-V2ZK0z3Lg@mail.gmail.com \
    --to=paul.richard.thomas@gmail.com \
    --cc=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).