[PATCH] fortran/36251 -- Fix PUBLIC and PRIVATE abuse
Steve Kargl
sgk@troutmask.apl.washington.edu
Sat May 17 17:47:00 GMT 2008
The attached patch and testcase address the issue raised
in PR fortran/36251. In brief, gfortran allows PUBLIC and
PRIVATE to be applied to the name of a MODULE. ie.,
module a
use b
public b
end module a
The standard does not explicitly disallow the above in a
constraint, but one can infer the standard that this is
not valid. In that gfortran appears to simply ignore the
attribute, I choose to make gfortran emit a warning. If
anyone feels strongly, he can upgrade this to an error.
In the audit trail to PR fortran/36251, Tobias notes that
BIND(C) gives an ICE for
module a
use b
bind(c) :: b
end module a
This ICE arise elsewhere in the compiler. I propose that
the attach patch be applied to tree, PR fortran/36251,
closed, and a new PR opened for the bind(c) issue.
2008-05-17 Steven G. Kargl <kargls@comcast.net>
* symbol.c (check_conflict): Warn about PUBLIC and PRIVATE applied to
a module name.
gfortran.dg/public_private_module.f90: New test.
--
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: symbol.c.diff
Type: text/x-diff
Size: 516 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080517/5eeece9f/attachment.bin>
-------------- next part --------------
! { dg-do compile }
! See PR fortran/36251.
module a
implicit none
integer :: i = 42
end module a
module b
use a
implicit none
public a ! { dg-warning "attribute applied to" }
end module b
module d
use a
implicit none
private a ! { dg-warning "attribute applied to" }
end module d
program c
use b
implicit none
end program c
! { dg-final { cleanup-modules "a b d" } }
More information about the Fortran
mailing list