Summary: | Protected and private specified at the same time and the symbol is accessible | ||
---|---|---|---|
Product: | gcc | Reporter: | Vladimir Fuka <vladimir.fuka> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | Keywords: | accepts-invalid |
Priority: | P3 | ||
Version: | 5.3.1 | ||
Target Milestone: | 4.9.4 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2016-07-22 00:00:00 |
Description
Vladimir Fuka
2016-07-22 10:17:46 UTC
Confirmed, all GCC releases are affected (I've got 4.5+). ICC compiler rejects the snippet: /home/marxin/Programming/testcases/pr71967.f90(2): error #6406: Conflicting attributes or multiple declaration of name. [K] protected :: k --------------^ /home/marxin/Programming/testcases/pr71967.f90(8): error #7013: This module file was not generated by any release of this compiler. [M] use m -----^ compilation aborted for /home/marxin/Programming/testcases/pr71967.f90 (code 1) > but I believe it should not.
Why? If you think it is because you have
protected :: k
private :: k
I did not find such a restriction in the standard.
OK, protected is not an access-stmt. But in that case, why is the private access-stmt ignored? > But in that case, why is the private access-stmt ignored?
It is not: consider
module m
protected :: k
private :: k
integer :: k = 42
end module
use m
integer :: k = 3
print *, k
end
'k' is set to 42 in module m, but is not visible in the main program where it is set to 3.
OMG, I forgot implicit none and the only clause. Sorry. So is ifort wrong in treating protected like an access statement? Dne 22. 7. 2016 13:04 napsal uživatel "dominiq at lps dot ens.fr" < gcc-bugzilla@gcc.gnu.org>: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71967 > > --- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > > But in that case, why is the private access-stmt ignored? > > It is not: consider > > module m > protected :: k > private :: k > > integer :: k = 42 > end module > > use m > integer :: k = 3 > print *, k > end > > 'k' is set to 42 in module m, but is not visible in the main program where > it > is set to 3. > > -- > You are receiving this mail because: > You reported the bug. > OMG, I forgot implicit none and the only clause. module m protected :: k private :: k integer k end module use m, only : k implicit none print *, k end is rejected by gfortran with pr71967_db_1.f90:8:14: use m, only : k 1 Error: Symbol 'k' referenced at (1) not found in module 'm' pr71967_db_1.f90:10:11: print *, k 1 Error: Symbol 'k' at (1) has no IMPLICIT type > So is ifort wrong in treating protected like an access statement? No idea, but IMO protected :: k public :: k should be valid. Note that if ifort is right, I'ld like to see where it is said so in the standard. I think we can mark this as INVALID then. The protected attribute is indeed not an access attribute. > I think we can mark this as INVALID then. ...
Doing so.
|