From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: Damian Rouson <damian@sourceryinstitute.org>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
Clune Tom <thomas.l.clune@nasa.gov>
Subject: Re: Bug 86906 - erroneous name clash with renaming in use statement
Date: Sun, 12 Aug 2018 08:55:00 -0000 [thread overview]
Message-ID: <CAGkQGiKtbhk-bxpJaQjepf-7rPQBXk3ByuxGK095UL7T0yVB5A@mail.gmail.com> (raw)
In-Reply-To: <CACR8rvc1ixSQDnjGRg6umwGM3tZ7yqjgiZpx_k9BqEjbr5GOpw@mail.gmail.com>
Dear All,
This fixes the bug and regtests OK:
Index: /home/pault/svn/trunk/gcc/fortran/resolve.c
===================================================================
*** /home/pault/svn/trunk/gcc/fortran/resolve.c (revision 262445)
--- /home/pault/svn/trunk/gcc/fortran/resolve.c (working copy)
*************** resolve_fl_variable_derived (gfc_symbol
*** 12071,12076 ****
--- 12076,12082 ----
namespace. 14.6.1.3 of the standard and the discussion on
comp.lang.fortran. */
if (sym->ns != sym->ts.u.derived->ns
+ && !sym->ts.u.derived->attr.use_assoc
&& sym->ns->proc_name->attr.if_source != IFSRC_IFBODY)
{
gfc_symbol *s;
The gotcha that causes the bug appears in the subsequent line
gfc_find_symbol (sym->ts.u.derived->name, sym->ns, 0, &s);
The symbol for the derived type retains the original name; it is the
symtree that is renamed. Comparing the symbol names is bound to cause
the clash.
I will clear my tree of the work on PR80477 and PR86481 (finalization
stuff) and will commit the fix as obvious.
Cheers
Paul
On Thu, 9 Aug 2018 at 22:36, Damian Rouson <damian@sourceryinstitute.org> wrote:
>
> gfortran 6.4, 7.3, and 8.2 all produce the error message below when
> attempting to use a renamed type in the same scope as the variable that
> motivated the renaming:
>
> $ cat foo.f90
> module foo
> type config
> end type
> end module
> use foo, only: foo_config => config
> contains
> subroutine cap
> integer config
> type(foo_config) extra
> end subroutine
> end
>
> $ gfortran foo.f90
> foo.f90:9:26:
>
> integer config
> 2
> type(foo_config) extra
> 1
> Error: The type ‘config’ cannot be host associated at (1) because it is
> blocked by an incompatible object of the same name declared at (2)
>
> $ gfortran --version
> GNU Fortran (GCC) 8.2.0
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
next prev parent reply other threads:[~2018-08-12 8:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 21:36 Damian Rouson
2018-08-12 8:55 ` Paul Richard Thomas [this message]
2018-08-12 15:38 ` Paul Richard Thomas
2018-08-12 16:26 ` Damian Rouson
2018-08-12 17:55 ` Clune, Thomas L. (GSFC-6101)
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=CAGkQGiKtbhk-bxpJaQjepf-7rPQBXk3ByuxGK095UL7T0yVB5A@mail.gmail.com \
--to=paul.richard.thomas@gmail.com \
--cc=damian@sourceryinstitute.org \
--cc=fortran@gcc.gnu.org \
--cc=thomas.l.clune@nasa.gov \
/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).