public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66993] New: Spurious ambiguous symbol error with submodules
@ 2015-07-24 12:11 mikael at gcc dot gnu.org
  2015-09-10  8:41 ` [Bug fortran/66993] " pault at gcc dot gnu.org
  2015-09-10 15:22 ` pault at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-07-24 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66993
           Summary: Spurious ambiguous symbol error with submodules
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikael at gcc dot gnu.org
  Target Milestone: ---

Submodules host-associate the (sub-)module they derive from.
This means that when a symbol is use-associated with the same name as one of
the module's symbols, there is no ambiguity: the use-associated symbol has the
priority.
This doesn't work currently, as host-association as been implemented by reusing
the use-association mechanism.  Module symbols are put at the same level as
use-associated symbols, and the compiler complains about an ambiguous symbol:

test.f90:15:16:

       print *, i
                1
Error: Name ‘i’ at (1) is an ambiguous reference to ‘i’ from module ‘m’


Testcase:

module m
  integer, parameter :: i = -1
  interface
    module subroutine show_i
    end subroutine show_i
  end interface
end module m

module n
  integer, parameter :: i = 2
end module n

submodule (m) sm
  use n
contains
  module subroutine show_i
    print *, i
  end subroutine show_i
end submodule sm

program p
  use m
  call show_i
end p


I believe this should be accepted and it should print 2.
>From gcc-bugs-return-493213-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 24 12:12:29 2015
Return-Path: <gcc-bugs-return-493213-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17315 invoked by alias); 24 Jul 2015 12:12:28 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17267 invoked by uid 48); 24 Jul 2015 12:12:24 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/66978] [6 Regression] bootstrap failure with --with-multilib-list=m32,m64,mx32
Date: Fri, 24 Jul 2015 12:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66978-4-kn0VV96TeN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66978-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66978-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg02103.txt.bz2
Content-length: 1204

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf978

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
A small testcase:

[hjl@gnu-6 pr66978]$ cat x.i
extern int foo (int *);
int
bar (int *p)
{
  __attribute__ ((noinline, noclone))
  int hack_digit (void)
    {
      return foo (p);
    }
  return hack_digit ();
}
[hjl@gnu-6 pr66978]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -mx32 -maddress-mode=short
-S -o x.s x.i
x.i: In function \u2018hack_digit\u2019:
x.i:6:7: internal compiler error: in emit_move_insn, at expr.c:3552
   int hack_digit (void)
       ^
0x9d9caf emit_move_insn(rtx_def*, rtx_def*)
        /export/gnu/import/git/sources/gcc/gcc/expr.c:3551
0xa55586 expand_function_start(tree_node*)
        /export/gnu/import/git/sources/gcc/gcc/function.c:5210
0x8ae9da execute
        /export/gnu/import/git/sources/gcc/gcc/cfgexpand.c:6105
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Makefile:15: recipe for target 'x.s' failed
make: *** [x.s] Error 1
[hjl@gnu-6 pr66978]$


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/66993] Spurious ambiguous symbol error with submodules
  2015-07-24 12:11 [Bug fortran/66993] New: Spurious ambiguous symbol error with submodules mikael at gcc dot gnu.org
@ 2015-09-10  8:41 ` pault at gcc dot gnu.org
  2015-09-10 15:22 ` pault at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pault at gcc dot gnu.org @ 2015-09-10  8:41 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-10
                 CC|                            |paul.richard.thomas at gmail dot c
                   |                            |om, pault at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> ---
Dear Mikael,

By golly, you are correct!

I'll take it.

Thanks for pointing this out.

Cheers

Paul


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/66993] Spurious ambiguous symbol error with submodules
  2015-07-24 12:11 [Bug fortran/66993] New: Spurious ambiguous symbol error with submodules mikael at gcc dot gnu.org
  2015-09-10  8:41 ` [Bug fortran/66993] " pault at gcc dot gnu.org
@ 2015-09-10 15:22 ` pault at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pault at gcc dot gnu.org @ 2015-09-10 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Thu Sep 10 15:22:20 2015
New Revision: 227648

URL: https://gcc.gnu.org/viewcvs?rev=227648&root=gcc&view=rev
Log:
2015-09-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/66993
        * module.c (read_module): If a symtree exists and the symbol has
        been associated in a submodule from a parent (sub)module, attach
        the symbol to a 'unique symtree' and the new symbol to the
        existing symtree.

2015-09-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/66993
        * gfortran.dg/submodule_11.f08: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/submodule_11.f08
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-10 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 12:11 [Bug fortran/66993] New: Spurious ambiguous symbol error with submodules mikael at gcc dot gnu.org
2015-09-10  8:41 ` [Bug fortran/66993] " pault at gcc dot gnu.org
2015-09-10 15:22 ` pault at gcc dot gnu.org

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).