Bug 20880 - USE association of procedure's own interface
Summary: USE association of procedure's own interface
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 29670
  Show dependency treegraph
 
Reported: 2005-04-08 16:00 UTC by Joost VandeVondele
Modified: 2006-11-25 14:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-30 20:43:17


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2005-04-08 16:00:34 UTC
The following is non-standard and the compiler should probably generate a
warning/error with '-pedantic -std=f95'

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
Comment 1 Francois-Xavier Coudert 2005-05-12 08:32:31 UTC
Confirmed.

Lahey says "line 11: Interface block which is use associated by this USE
statement containing an interface body for procedure 'my_sub' defined by this
subprogram is not standard-conforming."
Comment 2 Paul Thomas 2006-11-24 22:22:52 UTC
Subject: Bug 20880

Author: pault
Date: Fri Nov 24 22:22:40 2006
New Revision: 119173

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119173
Log:
2006-11-24  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* parse.c (parse_interface): Error if procedure name is that of
	encompassing scope.
	* resolve.c (resolve_fl_procedure): Error if procedure is
	ambiguous.

	PR fortran/29387
	* interface.c (compare_actual_formal): Add missing condition
	that 'where' be present for error that asserts that actual
	arguments be definable.

2006-11-24  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* gfortran.dg/interface_3.f90: New test.

	PR fortran/29387
	* gfortran.dg/generic_8.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/generic_8.f90
    trunk/gcc/testsuite/gfortran.dg/interface_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Paul Thomas 2006-11-25 14:38:07 UTC
Subject: Bug 20880

Author: pault
Date: Sat Nov 25 14:37:56 2006
New Revision: 119198

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119198
Log:
2006-11-25  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* parse.c (parse_interface): Error if procedure name is that of
	encompassing scope.
	* resolve.c (resolve_fl_procedure): Error if procedure is
	ambiguous.

	PR fortran/29837
	* interface.c (compare_actual_formal): Add missing condition
	that 'where' be present for error that asserts that actual
	arguments be definable.

2006-11-25  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* gfortran.dg/interface_3.f90: New test.

	PR fortran/29837
	* gfortran.dg/generic_8.f90: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/generic_8.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/interface_3.f90
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/interface.c
    branches/gcc-4_2-branch/gcc/fortran/parse.c
    branches/gcc-4_2-branch/gcc/fortran/resolve.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 4 Paul Thomas 2006-11-25 14:39:59 UTC
Fixed on trunk and 4.2.

Will backport to 4.1 in coming week.

Paul
Comment 5 Paul Thomas 2006-11-28 05:36:21 UTC
Subject: Bug 20880

Author: pault
Date: Tue Nov 28 05:36:07 2006
New Revision: 119272

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119272
Log:
2006-11-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* resolve.c (resolve_fl_procedure): Error if procedure is
	ambiguous modified to require attr.referenced.

2006-11-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* gfortran.dg/interface_3.f90: Modify errors.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/interface_3.f90

Comment 6 Paul Thomas 2006-11-28 05:50:31 UTC
Subject: Bug 20880

Author: pault
Date: Tue Nov 28 05:50:21 2006
New Revision: 119274

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119274
Log:
2006-11-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* resolve.c (resolve_fl_procedure): Error if procedure is
	ambiguous modified to require attr.referenced.

2006-11-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/20880
	* gfortran.dg/interface_3.f90: Modify errors.

Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/resolve.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/interface_3.f90