From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26546 invoked by alias); 2 Nov 2011 11:58:06 -0000 Received: (qmail 26535 invoked by uid 22791); 2 Nov 2011 11:58:06 -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; Wed, 02 Nov 2011 11:57:50 +0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50960] [OOP] vtables not marked as constant Date: Wed, 02 Nov 2011 11:58: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-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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 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-11/txt/msg00129.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50960 --- Comment #1 from janus at gcc dot gnu.org 2011-11-02 11:57:44 UTC --- (In reply to comment #0) > < richi> and it seems the vtables are not initialized in a way the > optimizers could use them > < richi> they are not constant Right. I had thought of making them PARAMETERS earlier (to use Fortran terminology). But in the early implementation this was not possible, since the PPC members of the vtabs were not initialized statically. Now they are, so this should work (in principle). I'll try if the following patch survives regtesting: Index: gcc/fortran/class.c =================================================================== --- gcc/fortran/class.c (revision 180713) +++ gcc/fortran/class.c (working copy) @@ -424,7 +424,7 @@ gfc_find_derived_vtab (gfc_symbol *derived) { gfc_get_symbol (name, ns, &vtab); vtab->ts.type = BT_DERIVED; - if (gfc_add_flavor (&vtab->attr, FL_VARIABLE, NULL, + if (gfc_add_flavor (&vtab->attr, FL_PARAMETER, NULL, &gfc_current_locus) == FAILURE) goto cleanup; vtab->attr.target = 1;