[Patch, fortran] PR29975 - [meta-bugs] ICEs with CP2K

Tobias Burnus burnus@net-b.de
Tue Dec 5 20:29:00 GMT 2006


Hi Paul,

Paul Thomas wrote:
> The second bug was slightly more complicated.  generic interfaces can
> be ambiguous if they do not contain ambiguous specific procedures. 
> This part of the patch is fixed in symbol.c by not raising the error
> if the symbol is generic.  Then the third part concerned the
> conditions in which ambiguous interfaces can cause an error - in
> essence, they must be referenced.  This allows correct use of two
> modules for other things than the ambiguous interfaces that they
> contain.  Finally, other compilers, a warning is omitted for an
> ambiguous interface, where only one is use associated, even if they
> are not referenced.  All this is done in interface.c.  Two new tests
> have been added and two were corrected; one by adding a reference to
> the ambiguous interfaces and another by changing an error to a warning.
I regression tested (x86_64-unknown-linux-gnu) and, looking at the patch
itself, I think it is ok.


I only miss a warning for the following invalid code:
  use mod1, only generic
  use mod2
The "only generic" makes it invalid, but gfortran gives with the patch
no warning.
[without the patch gfortran already wrongly rejects "use mod1; use mod2"
- as do g95 and sunf95.]

I think it is not that important since using the symbol gives an error,
but it still would be nice if there were a warning.


ifort gives:

fortcom: Warning: if.f90, line 19: The type/rank/keyword signature for
this specific procedure matches another specific procedure that shares
the same generic-name.   [BAR]
  use mod2
------^

(cf. Richard Main in
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/44aa13e0102ec83d/)

------------------------
module mod1
   interface generic
      subroutine foo(a)
         real :: a
      end subroutine
   end interface generic
end module  mod1

module mod2
   interface generic
      subroutine bar(a)
         real :: a
      end subroutine
   end interface generic
end module  mod2

program main
  use mod1, only: generic  ! import generic => make it invalid
  use mod2
end program main
------------------------

Tobias



More information about the Gcc-patches mailing list