From: Janus Weil <janus@gcc.gnu.org>
To: ethanbeyak@gmail.com
Cc: gfortran <fortran@gcc.gnu.org>
Subject: Re: Assignment interfaces with allocatable polymorphic variables in gfortran 5.5.0 & 8.1.0.
Date: Fri, 07 Sep 2018 05:56:00 -0000 [thread overview]
Message-ID: <CAKwh3qizC08Lfog0Pvd9ybamDmHf5wFFwtresjD6Dwu1cEGkKw@mail.gmail.com> (raw)
In-Reply-To: <CAJ3BazfiaERraGwCEffvgFUNDF_MM4oxHkWT8e9+=ueZHDLK_Q@mail.gmail.com>
Hi Ethan,
> However, on version 5.5, I get the following errors:
>
> OUTPUT 2
> =========
> $ gfortran --version
> GNU Fortran (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
>
> $ gfortran baz_module.f90 test_public_assignment.f90 -o test.out
> test_public_assignment.f90:13:0:
>
> wrk = e ! invoking foo
> 1
> Error: Assignment to an allocatable polymorphic variable at (1) is not yet
> supported
> test_public_assignment.f90:19:0:
Note that gfortran version 7 can also compile the program in its
original form (so you don't necessarily need version 8), but
unfortunately earlier versions fail.
> Now I did find some workaround by setting the default accessibility of the
> module to be public and explicitly declaring the complement of the set of
> procedures and variables that I wanted to be private. I'm not sure what
> gfortran 5.5.0 is doing to be honest, but the definition of the assignment
> can be used in the calling program. Commenting out lines 5,6 and commenting
> in lines 8,9 in baz_module.f90 gave me the following output on gfortran
> 5.5.0
>
> OUTPUT 3
> =========
> Compiler version: GCC version 5.5.0 20171010
> Compiler options: -mtune=generic -march=x86-64
> d: 4.00000000 2.00000000 1.00000000
> e: 8.00000000 6.00000000 4.00000000
> f: 32.0000000 18.0000000 8.00000000
> =========
>
> So I have two questions for the gfortran community: 1) do you know why
> inverting the module accessibility causes these assignments to work in
> gfortran 5.5.0? It seems as if the assignment interface was made public
> somehow, but I'm not certain.
Exactly, the "public" statement makes everything in the module public
by default. The assignment operator is private otherwise.
> 2) can you think of any *clean* solutions to
> this problem? I'd love backward compatibility while not going against the
> recommended standard of private default accessibility.
A more reasonable approach might be to not make everything public, but
just the assignment interface:
public assignment(=)
HTH,
Janus
next prev parent reply other threads:[~2018-09-07 5:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 20:18 Ethan Beyak
2018-09-07 5:56 ` Janus Weil [this message]
2018-09-07 14:36 ` Ethan Beyak
2018-09-07 17:20 ` Janus Weil
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=CAKwh3qizC08Lfog0Pvd9ybamDmHf5wFFwtresjD6Dwu1cEGkKw@mail.gmail.com \
--to=janus@gcc.gnu.org \
--cc=ethanbeyak@gmail.com \
--cc=fortran@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).