[Bug fortran/38065] private/public confusion with a contained function
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 11 14:30:00 GMT 2008
------- Comment #9 from burnus at gcc dot gnu dot org 2008-11-11 14:28 -------
(In reply to comment #6)
> reduced:
>
> SUBROUTINE S1
> CONTAINS
> TYPE(T1) FUNCTION F1()
> END FUNCTION F1
> END SUBROUTINE S1
Error: PUBLIC function 'f1' at (1) cannot be of PRIVATE type 't1'
gfortran has two bugs:
a) F1 is an internal function and thus PUBLIC/PRIVATE does not apply
b) If one makes F1 a (PUBLIC) *module* function, the program still would be a
valid Fortran 2003 program (and an invalid Fortran 95 program).
I still need to test whether the original program is fixed or not; there are
quite a lot files ...
Fix:
+++ gcc/fortran/resolve.c (Arbeitskopie)
@@ -10181,0 +10182 @@ resolve_fntype (gfc_namespace *ns)
+ && !sym->attr.contained
@@ -10186,2 +10187,3 @@ resolve_fntype (gfc_namespace *ns)
- gfc_error ("PUBLIC function '%s' at %L cannot be of PRIVATE type '%s'",
- sym->name, &sym->declared_at, sym->ts.derived->name);
+ gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PUBLIC function '%s' at "
+ "%L of PRIVATE type '%s'", sym->name,
+ &sym->declared_at, sym->ts.derived->name);
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065
More information about the Gcc-bugs
mailing list