Bug 48810 - [4.6/4.7 Regression] [OOP] TPB rejected because module procedure is private
Summary: [4.6/4.7 Regression] [OOP] TPB rejected because module procedure is private
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P4 normal
Target Milestone: 4.6.1
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-04-28 18:37 UTC by Tobias Burnus
Modified: 2011-04-29 21:27 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-04-29 05:41:52


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2011-04-28 18:37:15 UTC
Reported by Andrew Baldwin at c.l.f, cf.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/6e47d1d7271e4c02

The following program is accepted by NAG f95, by gfortran 4.5, and by Richard Maine, but gfortran 4.6/4.7 reject it with:

      bar = foo%getx()
            1
Error: 'gimmex' of 'foobar' is PRIVATE at (1)


      module qtest
      type foobar
        integer :: x
        contains
        private
        procedure :: gimmex
        generic, public :: getx => gimmex
      end type foobar
      contains
        function gimmex(foo)
          class (foobar) :: foo
          integer :: gimmex
          gimmex = foo%x
        end function gimmex
      end module qtest

      program quicktest
      use qtest
      type (foobar) :: foo
      integer :: bar
      bar = foo%getx()
      end program quicktest
Comment 1 Tobias Burnus 2011-04-28 19:26:59 UTC
Works: 2010-06-03-r160231
Fails: 2010-06-07-r160349

Should be the commit:

r160335 | janus | 2010-06-06 04:04:04 +0200 (So, 06. Jun 2010) | 19 Zeilen

2010-06-05  Paul Thomas  <pault@gcc.gnu.org>
            Janus Weil  <janus@gcc.gnu.org>

        PR fortran/43945
        * resolve.c (get_declared_from_expr): Move to before
        resolve_typebound_generic_call.  Make new_ref and class_ref
        ignorable if set to NULL.
        (resolve_typebound_generic_call): Once we have resolved the
        generic call, check that the specific instance is that which
        is bound to the declared type.
        (resolve_typebound_function,resolve_typebound_subroutine): Avoid
        freeing 'class_ref->next' twice.
Comment 2 Tobias Burnus 2011-04-29 05:41:52 UTC
Patch: http://gcc.gnu.org/ml/fortran/2011-04/msg00296.html
Comment 3 Tobias Burnus 2011-04-29 16:49:59 UTC
Author: burnus
Date: Fri Apr 29 16:49:53 2011
New Revision: 173175

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

        PR fortran/48810
        * resolve.c (resolve_typebound_generic_call): Don't check access
        flags of the specific function.

        PR fortran/48800
        * resolve.c (resolve_formal_arglist): Don't change AS_DEFERRED
        to AS_ASSUMED_SHAPE for function results.
        (resolve_fl_var_and_proc): Print also for function results with
        AS_DEFERRED an error, if they are not a pointer or allocatable.
        (resolve_types): Make sure arguments of procedures in interface
        blocks are resolved.

2011-04-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48810
        * gfortran.dg/typebound_proc_22.f90: New.

        PR fortran/48800
        * gfortran.dg/interface_36.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/interface_36.f90
    trunk/gcc/testsuite/gfortran.dg/typebound_proc_22.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Tobias Burnus 2011-04-29 21:26:10 UTC
Author: burnus
Date: Fri Apr 29 21:26:07 2011
New Revision: 173191

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

        PR fortran/48810
        * resolve.c (resolve_typebound_generic_call): Don't check access
        flags of the specific function.

        PR fortran/48800
        * resolve.c (resolve_formal_arglist): Don't change AS_DEFERRED
        to AS_ASSUMED_SHAPE for function results.
        (resolve_fl_var_and_proc): Print also for function results with
        AS_DEFERRED an error, if they are not a pointer or allocatable.
        (resolve_types): Make sure arguments of procedures in interface
        blocks are resolved.

2011-04-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48810
        * gfortran.dg/typebound_proc_22.f90: New.

        PR fortran/48800
        * gfortran.dg/interface_36.f90: New.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/interface_36.f90
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/typebound_proc_22.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/resolve.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 5 Tobias Burnus 2011-04-29 21:27:25 UTC
FIXED on the 4.7 trunk and on the 4.6.1 branch.

Thanks for the report, Andrew.