From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25334 invoked by alias); 18 Feb 2014 09:09:27 -0000 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 Received: (qmail 25295 invoked by uid 48); 18 Feb 2014 09:09:21 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/60255] Deferred character length variable at (1) cannot yet be associated with unlimited polymorphic entities Date: Tue, 18 Feb 2014 09:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg01781.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60255 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |janus at gcc dot gnu.org --- Comment #2 from janus at gcc dot gnu.org --- The error message comes from find_intrinsic_vtab, to which we'd have to pass a locus in order to show a proper line number. Currently we use gfc_current_locus, which is no good since the error happens during resolution. Also I think the 'TODO' is not suitable here: It is meant for the developer and not the user, and as such belongs in the source code and not into an error message. What does it actually take to make this feature work? Simply removing the error and using internally charlen=0 to identify deferred length makes the test module compile: Index: class.c =================================================================== --- class.c (revision 207836) +++ class.c (working copy) @@ -2404,18 +2404,9 @@ find_intrinsic_vtab (gfc_typespec *ts) gfc_symbol *copy = NULL, *src = NULL, *dst = NULL; int charlen = 0; - if (ts->type == BT_CHARACTER) - { - if (ts->deferred) - { - gfc_error ("TODO: Deferred character length variable at %C cannot " - "yet be associated with unlimited polymorphic entities"); - return NULL; - } - else if (ts->u.cl && ts->u.cl->length - && ts->u.cl->length->expr_type == EXPR_CONSTANT) - charlen = mpz_get_si (ts->u.cl->length->value.integer); - } + if (ts->type == BT_CHARACTER && !ts->deferred && ts->u.cl && ts->u.cl->length + && ts->u.cl->length->expr_type == EXPR_CONSTANT) + charlen = mpz_get_si (ts->u.cl->length->value.integer); /* Find the top-level namespace. */ for (ns = gfc_current_ns; ns; ns = ns->parent) Apparently we do not handle any non-constant string lengths currently. I guess all of those should either be rejected (like deferred lengths) or we should just make them work.