This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] Fix PR15976: Report wrong array spec


On Thursday 23 September 2004 15:05, Tobias Schlüter wrote:
> This patch removes two lines of code that have been there since before we
> kept a ChangeLog, and whose intention seems completely unclear to me: what
> it said was "if the current namespace is a module, every variable is
> allowed in an initialization expression". The bug was precisely that we
> didn't issue an error, so this doesn't make any sense.
>
> Bubblestrapped and tested on i686-linux
>
> - Tobi
>
> 2004-09-23  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
>
>  PR fortran/15976
>  * expr.c (check_restricted): Remove bogus condition.
>  (gfc_specification_expr): Remove empty line at beginning of function.

No. This is not the correct solution. Consider:

module m1
  integer :: n = 42

contains
subroutine foo(i)
  integer i(n) !!! Legal

  i = 0
end subroutine
end module

module m2
  use m1
  integer :: a(n) !!! Not legal
end module

What you need to do is make gfc_resove_symbol check that module variables have 
constant size, like PARAMETER variables.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]