From patchwork Sat Dec 7 18:05:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 298705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CCC5A2C00CB for ; Sun, 8 Dec 2013 05:05:59 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=CYaa5XkNTwmCUXnlO+dZ2UQyaBEiyqiRmfBktZ8y7wEWRW neTBhLpqp6FOs+sz6BncQt5H5uuGXyXvdRcoGpvLKyRDulEo8bSWCxfa1Jna6bMn PMMFM+mCjiQhaGP+eROlKl/OvhtMv0DvV7V6Kzu2lDEaZW4E+qPDC9p5qnYec= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=l0SFh3jyiyUOS+mdcg7lzg/36FM=; b=NU4WmtseJoBpuZdgxzFF wZnx37uSmmTkuFD5cAMxK9fah/xhCPGcxIRWTYhFH3FTNN0KWyNLbstHTs804faw OnSPaR2imlHtpFmmnIm0MmMYZuw5IEqKNlmIlrVFDC5c7R2+ypXqhnm7V0gVU4Id O4cxxdhSJG8i9Wwn7t6rpU8= Received: (qmail 21776 invoked by alias); 7 Dec 2013 18:05:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 21750 invoked by uid 89); 7 Dec 2013 18:05:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-qa0-f48.google.com Received: from Unknown (HELO mail-qa0-f48.google.com) (209.85.216.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 07 Dec 2013 18:05:46 +0000 Received: by mail-qa0-f48.google.com with SMTP id w5so1477296qac.7 for ; Sat, 07 Dec 2013 10:05:38 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.224.120.195 with SMTP id e3mr19081119qar.20.1386439538305; Sat, 07 Dec 2013 10:05:38 -0800 (PST) Received: by 10.96.156.38 with HTTP; Sat, 7 Dec 2013 10:05:38 -0800 (PST) Date: Sat, 7 Dec 2013 19:05:38 +0100 Message-ID: Subject: [Patch, Fortran, OOP] PR 59414: Class array pointers: compile error on valid code (Different ranks in pointer assignment) From: Janus Weil To: gfortran , gcc-patches Hi all, here is a small patch to fix a problem with class-array-valued functions, where the rank was not determined properly. Regtestes on x86_64-unknown-linux-gnu. Ok for trunk? [Note: This patch only fixes the rejects-valid problem of comment 0/1, but not the ICE of comment 2/3, which is a completely separate issue.] Cheers, Janus 2013-12-07 Janus Weil PR fortran/59414 * resolve.c (resolve_specific_f0): Handle CLASS-valued functions. 2013-12-07 Janus Weil PR fortran/59414 * gfortran.dg/class_result_2.f90: New. Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 205782) +++ gcc/fortran/resolve.c (working copy) @@ -2616,7 +2616,9 @@ found: expr->ts = sym->ts; expr->value.function.name = sym->name; expr->value.function.esym = sym; - if (sym->as != NULL) + if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as) + expr->rank = CLASS_DATA (sym)->as->rank; + else if (sym->as != NULL) expr->rank = sym->as->rank; return MATCH_YES;