public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roger.ferrer at bsc dot es" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/63744] New: Duplicate use-statement causes error
Date: Wed, 05 Nov 2014 08:46:00 -0000	[thread overview]
Message-ID: <bug-63744-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63744

            Bug ID: 63744
           Summary: Duplicate use-statement causes error
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roger.ferrer at bsc dot es

Hi,

(I guess this is related to PR34657)

The following snippet is accepted by gfortran

-- test-ok.f90
MODULE MOO
    INTEGER :: S
END MODULE MOO

SUBROUTINE S1
    USE MOO, ONLY: X => S, X => S

    X = 1
END SUBROUTINE S1
-- end of test-ok.f90

but it is rejected if the program unit SUBROUTINE S1 is renamed to SUBROUTINE
S,
as shown below

-- test.f90
MODULE MOO
    INTEGER :: S
END MODULE MOO

SUBROUTINE S
    USE MOO, ONLY: X => S, X => S

    X = 1
END SUBROUTINE S
-- end of test.f90

$ gfortran -c test.f90
test.f90:6.8:

    USE MOO, ONLY: X => S, X => S
        1
Error: 's' of module 'moo', imported at (1), is also the name of the current
program unit
test.f90:8.5:

    X = 1
     1
Error: Name 'x' at (1) is an ambiguous reference to 's' from module 'moo'

Removing the second rename lets the code be accepted.

  USE MOO, ONLY: X => S

A similar behaviour is observed if we have two repeated USE-statements rather
than two repeated rename's in the rename-list

  USE MOO, ONLY: X => S
  USE MOO, ONLY: X => S

Kind regards,


             reply	other threads:[~2014-11-05  8:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05  8:46 roger.ferrer at bsc dot es [this message]
2014-11-15 15:06 ` [Bug fortran/63744] [4.8/4.9/5 Regression] " dominiq at lps dot ens.fr
2014-11-15 15:42 ` burnus at gcc dot gnu.org
2014-11-15 16:14 ` dominiq at lps dot ens.fr
2014-11-15 17:00 ` burnus at gcc dot gnu.org
2014-11-15 17:04 ` dominiq at lps dot ens.fr
2014-11-19 13:28 ` rguenth at gcc dot gnu.org
2014-11-20 11:36 ` jakub at gcc dot gnu.org
2014-12-19 13:44 ` jakub at gcc dot gnu.org
2015-02-03 14:49 ` mikael at gcc dot gnu.org
2015-02-06 20:01 ` mikael at gcc dot gnu.org
2015-02-08 14:18 ` mikael at gcc dot gnu.org
2015-02-13 18:49 ` mikael at gcc dot gnu.org
2015-02-13 19:34 ` mikael at gcc dot gnu.org
2015-02-13 20:07 ` mikael at gcc dot gnu.org

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=bug-63744-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).