This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] Fix PR15976: Report wrong array spec
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 3 Oct 2004 16:02:37 +0100
- Subject: Re: [gfortran] Fix PR15976: Report wrong array spec
- Organization: CodeSourcery
- References: <4152D838.9060703@physik.uni-muenchen.de>
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