Fortran 2003 defines the PROTECTED attribute for variables in modules. Example:

-----------------------------------
MODULE temperature
 REAL,PROTECTED :: temp
 CONTAINS
 SUBROUTINE set_temperature
   temp = 0.0
 END SUBROUTINE
END MODULE

use temperature
call set_temperature
print *, temp
temp = 42
end
-----------------------------------

The compiler should issue an error message on that code (temp cannot be modified
from outside the module) but the code should compile fine without the "temp =
42" line.

The only compiler I know that behaves correctly right now is IBM's.

-- 
           Summary: PROTECTED attribute (F2003) is not implemented
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 20585
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23994

Reply via email to