From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27940 invoked by alias); 3 Nov 2011 14:34:41 -0000 Received: (qmail 27746 invoked by uid 22791); 3 Nov 2011 14:34:39 -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, 03 Nov 2011 14:34:22 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50960] [OOP] vtables not marked as constant Date: Thu, 03 Nov 2011 14:34: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: rguenth 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 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/msg00274.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50960 --- Comment #17 from Richard Guenther 2011-11-03 14:34:02 UTC --- (In reply to comment #16) > (In reply to comment #11) > > (In reply to comment #9) > > > FAIL: gfortran.dg/extends_type_of_1.f03 -O0 (internal compiler error) > > > FAIL: gfortran.dg/extends_type_of_3.f90 -O (internal compiler error) > > > > These two fail with: > > > > internal compiler error: in fold_convert_loc, at fold-const.c:1894 > > > > Not quite sure what goes wrong there. Some typing problem? > > > > > > Reduced test case: > > > > type :: t1 > > end type > > > > type, extends(t1) :: t2 > > end type > > > > class(t1), pointer :: c1 > > type(t2) :: y > > > > if (.not. extends_type_of (y, c1)) call abort() > > > > end > > Looks like you are converting struct __vtype_MAIN___T1 to > struct __vtype_MAIN___T1 *. Thus probably too many TREE_TYPE () > wrappers somewhere or a forgotten address-taking. > > Called from > > 4608 { > 4609 /* Scalar pointers. */ > 4610 se.want_pointer = 1; > 4611 gfc_conv_expr (&se, expr); > 4612 gfc_add_block_to_block (&block, &se.pre); > 4613 gfc_add_modify (&block, dest, > 4614 fold_convert (TREE_TYPE (dest), > se.expr)) > > where se.want_pointer (whatever it means) is not honored and se.expr > is a variable of type struct __vtype_MAIN___T1. Missing handling of se.want_pointer at least here: void gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init) { ... if (!init) { /* Create a temporary variable and fill it in. */ se->expr = gfc_create_var (type, expr->ts.u.derived->name); tmp = gfc_trans_structure_assign (se->expr, expr); gfc_add_expr_to_block (&se->pre, tmp); return; but what's the desire of the caller? Is it to get &expr? Something seems to be seriously wrong.