From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11755 invoked by alias); 4 Aug 2011 11:15:39 -0000 Received: (qmail 11739 invoked by uid 22791); 4 Aug 2011 11:15:35 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Aug 2011 11:15:22 +0000 From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/49638] [OOP] length parameter is ignored when overriding type bound character functions with constant length. X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 04 Aug 2011 11:15:00 -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 X-SW-Source: 2011-08/txt/msg00498.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49638 --- Comment #12 from Mikael Morin 2011-08-04 11:14:36 UTC --- If we are willing to do some simple expression comparisons, here is what I think should be supported (most common cases): - constants: this is the minimum - variables/dummies: for the case len=n - sub-components: for the case len=derived%char_length_comp - function calls: for the case len=len(some_char) - arithmetic operators: for the case len=n+1 So, only missing in your preliminary patch are sub-components and function. (In reply to comment #9) > > I don't know however how you will have two corresponding dummy > > arguments (from different procedures) compare equal. > > Well, the patch in comment #7 handles this by just comparing the names of the > arguments (which have to be the same in overridden procedures, so I this this > will be enough): > > + case EXPR_VARIABLE: > + if (strcmp (e1->symtree->n.sym->name, e1->symtree->n.sym->name) != 0) > + return FAILURE; > Ah, yes. > > gfc_dep_compare_expr relies on a function called 'gfc_are_identical_variables'. > This really checks for equal symbols, which is too strict for our case here (so > we may add an extra argument to loosen this restriction?). Yes, makes sense. Then you have components and functions almost for free.