From patchwork Sun Jan 27 13:18:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1031578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-494797-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xd3t+cPa"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="mDwtIn06"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43nYJ24D3Zz9s7h for ; Mon, 28 Jan 2019 00:19:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=GcACZCSbgrn+FmraGcAl0xsMrC0JgeSSXOIt35d6X93Rq75bCa eLiQzSItHVVqHdDg/w5VWEQW/eT5Y5YbF/2/Rkooev1yc/77wQhjiiwRwhkZLW7a /77uLV03ROJIJkTzLQSu4c3aQrlOfttWZItvMKpVWeCevwLoOI+89ciZQ= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=5dZ5joBOVXw09DoCMq8uoNTkPqI=; b=xd3t+cParrqqY5og0kFR M/3vNld1pI9HnbvRneJ3y6yj/Yr2XdPlj++SZsxt6Zj3uUAXpRzbw30+3tlokWlp kIlaEGVk7Fb+CoeiDoZ/gAgh7f/+9jWOhwwEsonS+HzngoO0DN+QD5GcsUwL/Pg6 iR9wnibx9AaIFqfHr8ZBIxA= Received: (qmail 111259 invoked by alias); 27 Jan 2019 13:19:04 -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 111242 invoked by uid 89); 27 Jan 2019 13:19:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: cc-smtpout3.netcologne.de Received: from cc-smtpout3.netcologne.de (HELO cc-smtpout3.netcologne.de) (89.1.8.213) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 27 Jan 2019 13:19:01 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 375AE12863; Sun, 27 Jan 2019 14:18:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1548595139; bh=YkyQyL+CpnBvHoQ5D3Z3YFU2CyRtK6wYw27YDCKq8vk=; h=To:From:Subject:Message-ID:Date:From; b=mDwtIn06YbGHI2JJkxmRAoDRD51vbbd0zULdljhhPELIWqBo82xyB6qKwUbxLSPp5 p/YDk7nJqDd4EmvPAlS90xYhHdjwCc2ZC73l60Dmx5bFryJSkhH8qgsN3iKcXNTpbu 6+Jb+1O6cIcmNE/+Lcy/pfzWW0DrxZQiNgK4QTODlDPvoDbsaIwksf3hXMz+VsJQNU fe4A2ySmHWX1o9vfQdFrbNxsLu256Fik7419ABglqVtCURi2Yhd6NBptYb7ph1Trzl z4T0fxDHM1T3yPc8kEuRUq4CK+E2GFSCGGGi3jytQphIWQl8LHuEJ57gZ28DZ1hagJ BDvKiOL78gNQg== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id 33FA911D93; Sun, 27 Jan 2019 14:18:59 +0100 (CET) Received: from [78.35.135.47] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5c4dafc3-0bea-7f0000012729-7f000001b188-1 for ; Sun, 27 Jan 2019 14:18:59 +0100 Received: from [192.168.178.68] (xdsl-78-35-135-47.nc.de [78.35.135.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Sun, 27 Jan 2019 14:18:57 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 88669, rejects-valid Message-ID: <438e0138-9304-2eca-0835-cabb13cf9031@netcologne.de> Date: Sun, 27 Jan 2019 14:18:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Hello world, the attached, rather straightforward patch fixes a rejects-valid error by fixing up the contiguous attribute for a class, and by using the correct attributes. Regression-tested. OK for trunk? Regards Thomas 2019-01-27 Thomas Koenig PR fortran/88669 * resolve.c (resolve_component): If the reference is a BT_CLASS, copy the contiguous attribute from the reference and use the correct attributes. 2019-01-27 Thomas Koenig PR fortran/88669 * gfortran.dg/contiguous_9.f90: New test. Index: resolve.c =================================================================== --- resolve.c (Revision 268104) +++ resolve.c (Arbeitskopie) @@ -13761,6 +13761,7 @@ static bool resolve_component (gfc_component *c, gfc_symbol *sym) { gfc_symbol *super_type; + symbol_attribute *attr; if (c->attr.artificial) return true; @@ -13803,8 +13804,24 @@ resolve_component (gfc_component *c, gfc_symbol *s } /* F2008, C448. */ - if (c->attr.contiguous && (!c->attr.dimension || !c->attr.pointer)) + if (c->ts.type == BT_CLASS) { + if (CLASS_DATA (c)) + { + attr = &(CLASS_DATA (c)->attr); + + /* Fix up contiguous attribute. */ + if (c->attr.contiguous) + attr->contiguous = 1; + } + else + attr = NULL; + } + else + attr = &c->attr; + + if (attr && attr->contiguous && (!attr->dimension || !attr->pointer)) + { gfc_error ("Component %qs at %L has the CONTIGUOUS attribute but " "is not an array pointer", c->name, &c->loc); return false;