From patchwork Thu Dec 8 21:59:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 31509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp442182wrr; Thu, 8 Dec 2022 14:00:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6yqTdPdboFLXsBiEYYm1UHzZr3sW9qGrWcm47mm/J1qQyiVcU5tAGW/k0XmaHT9Bb24FP8 X-Received: by 2002:a05:6402:4021:b0:46c:fabe:835d with SMTP id d33-20020a056402402100b0046cfabe835dmr5184164eda.12.1670536834715; Thu, 08 Dec 2022 14:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670536834; cv=none; d=google.com; s=arc-20160816; b=FbIA6DnZdtWBd5YSjcA9DK5LBAArff5+VIl2j47BmNTU4/8b9SO5jz9W+tllMoxMv3 1za4zpeK4vyg7HuhEAdlcym75f80/E8XGRjPfYMNBYDl69+SwgLaiZKSfzUtFV/ZRf9K U1/qXqNPwew3xlCyUMpQWjLur7q+SQ7zjBJFx6Qt1WURYXHJ928grz82bEVLx0iUQ8zP BT8JGyBMMl43M9f16N/Xl6LnqBjGItsGYqdvDiqKIp4s8Adalbjgf6FHDwto6Qo+h7th hwZHCEtuUUTzUMW6cnOS8aPSz24EVyiFEJvl6GKOn36v5E1JBoCzKH0Z7EWJi6RvRGso ZOpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:ui-outboundreport :sensitivity:importance:date:subject:to:message-id:mime-version :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=e2zuSEJWvRPfc/JXpVZf0naJ62/uORTXtEDO0GodJzo=; b=dqwiE4DbZBpZ+xhucbk11VnRxB4pIEa1lohtgHD2i7H8olmWq7Uy44YMyLi7s2lNzL UhlSFRhkWjJgiCQtHgkMDLu6hq2gINGR60GiVEfJ7yJ8rPtz8YLmPFXA5i5FuRkT9IXB XPPjocgMbY7ON9h/c80ywAXBjlnvJULvdad0Y4+j0fplg0dQ87cCFuGbJnUWoLEICizf Uj4vCr7fjwdoE1kR8ntoKp8P2FG0ozH4q3vGsttQwRsH+vmpQ3suc/3E+vXdSN0K2aZd vqx8ItZoHv79qUJmaJDjCtrPvJOS4GMxcH+1AE9LXZ3v3arAWbnzozjwkHbv77F3kEg2 j8CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ijz9sMvo; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ee16-20020a056402291000b004677a9c4b39si6486117edb.91.2022.12.08.14.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 14:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ijz9sMvo; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A67B0388C5C9 for ; Thu, 8 Dec 2022 22:00:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A67B0388C5C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670536833; bh=e2zuSEJWvRPfc/JXpVZf0naJ62/uORTXtEDO0GodJzo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Ijz9sMvoMxnbri5iD1U6BRyAzpvwhWeDetFtwtcWrQNIG/zSuf+2z45yfIAXzWoex tAiHYMogIY/NeIKgMoPno1RzvXZi0PDiA4vch50GqlPbfxJPRRnstr3m+j0UpDnXYX YPH9f0me0ewOM+9Ld9P5h6Vus/PhTt3DSYmmRD8M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by sourceware.org (Postfix) with ESMTPS id 7E3B43A097F2; Thu, 8 Dec 2022 21:59:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E3B43A097F2 X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [93.207.90.194] ([93.207.90.194]) by web-mail.gmx.net (3c-app-gmx-bap18.server.lan [172.19.172.88]) (via HTTP); Thu, 8 Dec 2022 22:59:42 +0100 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH] Fortran: diagnose and reject duplicate CONTIGUOUS attribute [PR108025] Date: Thu, 8 Dec 2022 22:59:42 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:QocFlgYT2u4Lu6u/bgv3uv87Os0lKrUMKpWx6AngVGStR1Yu1+ARE9ksjxtRhpjNoO4Sv WY0T+gRMz2DpKP28Wj2zdxzkpr69razIYnMQSRz9R2FRecVsiLsoCBmUyy4M5JQYesdWl310xY1j xdG1loauqtPJ1SIG2UemaqOtl3kHKxjyqvO6XL3RvnaZ7oGGXuXTmRTxsS9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_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Harald Anlauf via Gcc-patches From: Harald Anlauf Reply-To: Harald Anlauf Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751684832253840784?= X-GMAIL-MSGID: =?utf-8?q?1751684832253840784?= Dear all, a fairly obvious, or rather trivial fix that appeared while analyzing another pr and that can be treated independently: reject duplicate CONTIGUOUS attributes. (Intel and NAG reject this, Cray warns that this is non-standard.) Regtested on x86_64-pc-linux-gnu. OK for mainline? Thanks, Harald From 3a9f6d5a8ee490adf9a18f93feaf86542642be7d Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Thu, 8 Dec 2022 22:50:45 +0100 Subject: [PATCH] Fortran: diagnose and reject duplicate CONTIGUOUS attribute [PR108025] gcc/fortran/ChangeLog: PR fortran/108025 * symbol.cc (gfc_add_contiguous): Diagnose and reject duplicate CONTIGUOUS attribute. gcc/testsuite/ChangeLog: PR fortran/108025 * gfortran.dg/contiguous_12.f90: New test. --- gcc/fortran/symbol.cc | 6 ++++++ gcc/testsuite/gfortran.dg/contiguous_12.f90 | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/contiguous_12.f90 diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index 49fb37864bd..e704e7ac2bd 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -1108,6 +1108,12 @@ gfc_add_contiguous (symbol_attribute *attr, const char *name, locus *where) if (check_used (attr, name, where)) return false; + if (attr->contiguous) + { + duplicate_attr ("CONTIGUOUS", where); + return false; + } + attr->contiguous = 1; return gfc_check_conflict (attr, name, where); } diff --git a/gcc/testsuite/gfortran.dg/contiguous_12.f90 b/gcc/testsuite/gfortran.dg/contiguous_12.f90 new file mode 100644 index 00000000000..9c477a7a06a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/contiguous_12.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/108025 + +subroutine foo (x) + real, contiguous :: x(:) + contiguous :: x ! { dg-error "Duplicate CONTIGUOUS attribute" } +end -- 2.35.3