Bug 33072 - "use mod, only: operator(.sub.)" matches any procedure "sub"
Summary: "use mod, only: operator(.sub.)" matches any procedure "sub"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, rejects-valid
Depends on:
Blocks: 31298
  Show dependency treegraph
 
Reported: 2007-08-14 21:02 UTC by Tobias Burnus
Modified: 2007-08-16 18:20 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-08-14 21:16:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-08-14 21:02:23 UTC
Expected: An error that the user operator .sub. does not exist.

Actually: Compiles.

NAG f95:
Error: foo.f90, line 9: Cannot find symbol .SUB. in module A


module a
 implicit none
contains
  subroutine sub()
  end subroutine sub
end module a

program test
use a, only: operator(.sub.)
end program test
Comment 1 Tobias Burnus 2007-08-14 21:24:51 UTC
Extended example (rejects-valid + accepts-invalid):
(Overlaps partially with PR31298)

module a
 implicit none
interface operator(.op.)
  module procedure sub
end interface
contains
  function sub(i)
    integer :: sub
    integer,intent(in) :: i
    sub = -i
  end function sub
end module a

program test
! works, but shouldn't
use a, only: operator(.sub.), operator(.my.) => operator(.sub.)
!
! Does not work, but should:
!use a, only: operator(.op.), operator(.my.) => operator(.op.)
!Error: Symbol 'op' referenced at (1) not found in module 'a'
end program test
Comment 2 patchapp@dberlin.org 2007-08-16 16:50:27 UTC
Subject: Bug number PR33072

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01039.html
Comment 3 Tobias Burnus 2007-08-16 18:17:58 UTC
Subject: Bug 33072

Author: burnus
Date: Thu Aug 16 18:17:46 2007
New Revision: 127564

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127564
Log:
2007-08-16  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33072
	* module.c (gfc_match_use): Mark user operators as such.
	(find_use_name_n): Distinguish between operators and other symbols.
	(find_use_name,number_use_names,mio_namelist,
	 load_operator_interfaces,load_generic_interfaces,read_module,
	 write_generic): Update find_use_name_n calls.

2007-08-16  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33072
	* gfortran.dg/use_9.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/use_9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Tobias Burnus 2007-08-16 18:20:17 UTC
FIXED - but only the initially reported bug. The other I push back to PR31298.