public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34657]  New: program-unit MY_SUB imports symbol MY_SUB
@ 2008-01-03 20:18 jv244 at cam dot ac dot uk
  2008-01-04  9:12 ` [Bug fortran/34657] " burnus at gcc dot gnu dot org
  0 siblings, 1 reply; 7+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-01-03 20:18 UTC (permalink / raw)
  To: gcc-bugs

The following is non-standard and the compiler should probably generate a
warning/error with '-pedantic -std=f95', but does not do so with
gcc version 4.3.0 20080103 (experimental) [trunk revision 131300] (GCC)

module test_mod
interface
  subroutine my_sub (a)
    real a
  end subroutine
end interface
end module

subroutine my_sub (a)
  use test_mod
  real a
  print *, a
end subroutine

END


-- 
           Summary: program-unit MY_SUB imports symbol MY_SUB
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657


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

* [Bug fortran/34657] program-unit MY_SUB imports symbol MY_SUB
  2008-01-03 20:18 [Bug fortran/34657] New: program-unit MY_SUB imports symbol MY_SUB jv244 at cam dot ac dot uk
@ 2008-01-04  9:12 ` burnus at gcc dot gnu dot org
  0 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-04  9:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-01-04 07:29 -------
NAG f95 and g95 print an error:
  Error: USE TEST_MOD in program-unit MY_SUB imports symbol MY_SUB
  Error: Module 'test_mod' at (1) redefines the current program unit 'my_sub'

ifort prints nothing by default and with -stand f95:
  Warning: An interface-block in a subprogram shall not contain an
interface-body for a procedure defined by that subprogram.   [MY_SUB]


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-04 07:29:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657


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

* [Bug fortran/34657] program-unit MY_SUB imports symbol MY_SUB
       [not found] <bug-34657-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-07-17 20:18 ` burnus at gcc dot gnu.org
@ 2011-07-18  6:22 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-07-18  6:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-18 06:20:23 UTC ---
(In reply to comment #5)
> FIXED on the trunk (4.7). Thanks for the bug report - and sorry that it took 3
> years to fix it.

Really close as FIXED


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

* [Bug fortran/34657] program-unit MY_SUB imports symbol MY_SUB
       [not found] <bug-34657-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-07-17 19:58 ` burnus at gcc dot gnu.org
@ 2011-07-17 20:18 ` burnus at gcc dot gnu.org
  2011-07-18  6:22 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-07-17 20:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-17 20:17:42 UTC ---
FIXED on the trunk (4.7). Thanks for the bug report - and sorry that it took 3
years to fix it.


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

* [Bug fortran/34657] program-unit MY_SUB imports symbol MY_SUB
       [not found] <bug-34657-4@http.gcc.gnu.org/bugzilla/>
  2011-07-17 11:55 ` burnus at gcc dot gnu.org
  2011-07-17 15:24 ` tkoenig at gcc dot gnu.org
@ 2011-07-17 19:58 ` burnus at gcc dot gnu.org
  2011-07-17 20:18 ` burnus at gcc dot gnu.org
  2011-07-18  6:22 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-07-17 19:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-17 19:57:13 UTC ---
Author: burnus
Date: Sun Jul 17 19:57:10 2011
New Revision: 176375

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176375
Log:
2011-07-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34657
        * module.c (check_for_ambiguous): Check whether the name is
        * matches
        the current program unit.

2011-07-17  Tobias Burnus  <burnus@net-b.de>
            Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/34657
        * gfortran.dg/generic_17.f90: Fix testcase.
        * gfortran.dg/interface_3.f90: Add dg-error.
        * gfortran.dg/use_14.f90: New.
        * gfortran.dg/use_15.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/use_14.f90
    trunk/gcc/testsuite/gfortran.dg/use_15.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/generic_17.f90
    trunk/gcc/testsuite/gfortran.dg/interface_3.f90


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

* [Bug fortran/34657] program-unit MY_SUB imports symbol MY_SUB
       [not found] <bug-34657-4@http.gcc.gnu.org/bugzilla/>
  2011-07-17 11:55 ` burnus at gcc dot gnu.org
@ 2011-07-17 15:24 ` tkoenig at gcc dot gnu.org
  2011-07-17 19:58 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-07-17 15:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-07-17 15:24:02 UTC ---
(In reply to comment #2)

The patch causes two "regressions".

The first one, in interface_3.f90, triggers because the error message
from this patch takes precedence over the "ambiguous" error message
before. This should be fine with changing the error message in the
test case.

The second one, in generic_17.f90, is simply an incorrect test case,
which is very much like the one from the test case.

For the test case for this PR, please also add a test case like

module test_mod
interface
  subroutine my_sub (a)
    real a
  end subroutine
end interface
end module

subroutine my_sub (a)
  use test_mod, gugu => my_sub
  real a
  print *, a
end subroutine

END

(which is OK, and which passes for your patch).


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

* [Bug fortran/34657] program-unit MY_SUB imports symbol MY_SUB
       [not found] <bug-34657-4@http.gcc.gnu.org/bugzilla/>
@ 2011-07-17 11:55 ` burnus at gcc dot gnu.org
  2011-07-17 15:24 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-07-17 11:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34657

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-17 11:54:40 UTC ---
Draft patch:

--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4278,6 +4278,13 @@ check_for_ambiguous (gfc_symbol *st_sym, pointer_info
*info)
   module_locus locus;
   symbol_attribute attr;

+  if (st_sym->ns->proc_name && st_sym->name == st_sym->ns->proc_name->name)
+    {
+      gfc_error ("'%s' of module '%s' imported at %C is also the name of the "
+                "current program unit", st_sym->name, module_name);
+      return true;
+    }
+
   rsym = info->u.rsym.sym;
   if (st_sym == rsym)
     return false;


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

end of thread, other threads:[~2011-07-18  6:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-03 20:18 [Bug fortran/34657] New: program-unit MY_SUB imports symbol MY_SUB jv244 at cam dot ac dot uk
2008-01-04  9:12 ` [Bug fortran/34657] " burnus at gcc dot gnu dot org
     [not found] <bug-34657-4@http.gcc.gnu.org/bugzilla/>
2011-07-17 11:55 ` burnus at gcc dot gnu.org
2011-07-17 15:24 ` tkoenig at gcc dot gnu.org
2011-07-17 19:58 ` burnus at gcc dot gnu.org
2011-07-17 20:18 ` burnus at gcc dot gnu.org
2011-07-18  6:22 ` burnus 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).