From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2785 invoked by alias); 11 Nov 2008 14:30:43 -0000 Received: (qmail 25432 invoked by uid 48); 11 Nov 2008 14:28:49 -0000 Date: Tue, 11 Nov 2008 14:30:00 -0000 Message-ID: <20081111142849.25426.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/38065] private/public confusion with a contained function In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-11/txt/msg00800.txt.bz2 ------- 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