public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95
@ 2012-04-25 10:21 middag at users dot sourceforge.net
  2012-04-25 11:42 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be included again with -std=f95 janus at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: middag at users dot sourceforge.net @ 2012-04-25 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53111
           Summary: Derived types cannot be included again when using
                    standard Fortran 95
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: middag@users.sourceforge.net


Created attachment 27234
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27234
Test file which fails to compile with -std=f95

When you have a derived type defined in a module (A), which is used in another
module (B) and the program itself which also uses module(B), the compiler gives
an error with '-std=f95' option (gfortran -std=f95 -o test test.f95): 

"Error: Fortran 2003: Generic name 'my' of function 'my' at (1) being the same
name as derived type at (2)"

See attached file for an example. Some extensive searching on the web and
"Modern Fortran explained" does not give reason to believe that this is the way
it is supposed to behave when adhering to the Fortran 95 standard.

Output of 'gcc -v':

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7-20120414/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id
--with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold
--enable-ld=default --enable-plugin --with-plugin-ld=ld.gold
--with-linker-hash-style=gnu --disable-multilib --disable-libssp
--disable-build-with-cxx --disable-build-poststage1-with-cxx
--enable-checking=release
Thread model: posix
gcc version 4.7.0 20120414 (prerelease) (GCC)


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be included again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
@ 2012-04-25 11:42 ` janus at gcc dot gnu.org
  2012-04-25 13:01 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated " burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2012-04-25 11:42 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-25
                 CC|                            |janus at gcc dot gnu.org
            Summary|Derived types cannot be     |[4.7/4.8 Regression]
                   |included again when using   |Derived types cannot be
                   |standard Fortran 95         |included again with
                   |                            |-std=f95
     Ever Confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org 2012-04-25 11:41:43 UTC ---
Confirmed. This is a regression in gfortran 4.7 (and trunk, 4.6 works).
Slightly reduced test case:

module a
  type :: my
    real :: x
  end type
end module

module b
  use a
end module

program test
  use a
  use b
end program


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
  2012-04-25 11:42 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be included again with -std=f95 janus at gcc dot gnu.org
@ 2012-04-25 13:01 ` burnus at gcc dot gnu.org
  2012-04-26 14:24 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-25 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |burnus at gcc dot gnu.org
   Target Milestone|---                         |4.7.1
            Summary|[4.7/4.8 Regression]        |[4.7/4.8 Regression]
                   |Derived types cannot be     |Derived types cannot be
                   |included again with         |USE-associated again with
                   |-std=f95                    |-std=f95


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
  2012-04-25 11:42 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be included again with -std=f95 janus at gcc dot gnu.org
  2012-04-25 13:01 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated " burnus at gcc dot gnu.org
@ 2012-04-26 14:24 ` rguenth at gcc dot gnu.org
  2012-05-02  6:08 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-26 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2012-04-26 14:24 ` rguenth at gcc dot gnu.org
@ 2012-05-02  6:08 ` burnus at gcc dot gnu.org
  2012-05-04 18:54 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-02  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-02 06:08:20 UTC ---
Something like the following should work; it might require some refinement or
can be shorted. (Completely untested.)

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -12015,6 +12046,10 @@ resolve_fl_derived (gfc_symbol *sym)
   if (!sym->attr.is_class)
     gfc_find_symbol (sym->name, sym->ns, 0, &gen_dt);
   if (gen_dt && gen_dt->generic && gen_dt->generic->next
+      && (gen_dt->generic->next->next
+         || !gen_dt->generic->sym->attr.use_assoc
+         || gen_dt->generic->sym->module
+           != gen_dt->generic->next->sym->module)
       && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Generic name '%s' of "
                         "function '%s' at %L being the same name as derived "
                         "type at %L", sym->name,


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2012-05-02  6:08 ` burnus at gcc dot gnu.org
@ 2012-05-04 18:54 ` burnus at gcc dot gnu.org
  2012-05-05 10:00 ` burnus at gcc dot gnu.org
  2012-05-05 10:07 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-04 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-04 18:53:23 UTC ---
Author: burnus
Date: Fri May  4 18:53:17 2012
New Revision: 187174

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187174
Log:
2012-05-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53111
        * resolve.c (resolve_fl_derived): Fix -std=f95
        diagnostic for generic vs. DT names.

2012-05-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53111
        * gfortran.dg/constructor_7.f90: New.
        * gfortran.dg/constructor_8.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/constructor_7.f90
    trunk/gcc/testsuite/gfortran.dg/constructor_8.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
                   ` (4 preceding siblings ...)
  2012-05-04 18:54 ` burnus at gcc dot gnu.org
@ 2012-05-05 10:00 ` burnus at gcc dot gnu.org
  2012-05-05 10:07 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-05 10:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-05 09:53:25 UTC ---
Author: burnus
Date: Sat May  5 09:53:21 2012
New Revision: 187193

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187193
Log:
2012-05-05  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2012-05-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53111
        * resolve.c (resolve_fl_derived): Fix -std=f95
        diagnostic for generic vs. DT names.

2012-05-05  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2012-05-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53111
        * gfortran.dg/constructor_7.f90: New.
        * gfortran.dg/constructor_8.f90: New.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/constructor_7.f90
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/constructor_8.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/resolve.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated again with -std=f95
  2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
                   ` (5 preceding siblings ...)
  2012-05-05 10:00 ` burnus at gcc dot gnu.org
@ 2012-05-05 10:07 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-05 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-05 10:05:49 UTC ---
FIXED on the trunk (4.8) and on the 4.7 branch. (It will be in GCC 4.7.1.)

Thanks for the bug report!


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

end of thread, other threads:[~2012-05-05 10:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 10:21 [Bug fortran/53111] New: Derived types cannot be included again when using standard Fortran 95 middag at users dot sourceforge.net
2012-04-25 11:42 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be included again with -std=f95 janus at gcc dot gnu.org
2012-04-25 13:01 ` [Bug fortran/53111] [4.7/4.8 Regression] Derived types cannot be USE-associated " burnus at gcc dot gnu.org
2012-04-26 14:24 ` rguenth at gcc dot gnu.org
2012-05-02  6:08 ` burnus at gcc dot gnu.org
2012-05-04 18:54 ` burnus at gcc dot gnu.org
2012-05-05 10:00 ` burnus at gcc dot gnu.org
2012-05-05 10:07 ` 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).