From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1670536782; bh=qMS9T/4/fF3WAHA/picYKEA1I2vsAvIsyUkxXRjKJQE=; h=X-UI-Sender-Class:From:To:Subject:Date; b=AodzYCMipKE8pyWtucBHpS1n0qv3P4KzM3mTH7In5JF3WNuJ5bspIANlseT/RAdHE Cx1bNZVxYjJXAYwVrvwJ+7amufHGhlGREPHNaoGBmFYSay+B+s84JHhWenIcIOy9GF nnUSM6K81cATzQRyLDPUaFiyabysLhiYdtLdRG5VDA2743bDROb0nPhY7o+WXZLjkV cjWTcGLcmhKOfBXDsFEk9+49euqPloqAcrNS5xrtoE5HsMteMdwErQP6e4C/Y6gnq4 RlSsfnHYSaOhA1v/a4p8bt/z7TI6pyq0tcUqf176tTrv2gFoGdmv6Dn9Yiu+B8diYr qkWd3gC1HlHmg== 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: From: Harald Anlauf To: fortran , gcc-patches Subject: [PATCH] Fortran: diagnose and reject duplicate CONTIGUOUS attribute [PR108025] Content-Type: multipart/mixed; boundary=sgnirk-b17cf5de-5a0c-43aa-85dc-9c699af51078 Date: Thu, 8 Dec 2022 22:59:42 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03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vlupfAjuVACpeCdm+T4kbJ933gxR7CHwe+ U7LHQURWcedNLcdjZwzotLr0Mciyvub4uuGlK0nmqXYslTPEvjwvDBAvm6lFoAevRwBXEkKFz OAD84x/nDPlx32bRLKfytfDWqGQGTQJwYfLyh4HV1blvM= X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_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 List-Id: --sgnirk-b17cf5de-5a0c-43aa-85dc-9c699af51078 Content-Type: text/plain; charset=UTF-8 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 --sgnirk-b17cf5de-5a0c-43aa-85dc-9c699af51078 Content-Type: text/x-patch Content-Disposition: attachment; filename=pr108025.diff Content-Transfer-Encoding: quoted-printable =46rom 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 attribu= te [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. =2D-- 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 =2D-- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -1108,6 +1108,12 @@ gfc_add_contiguous (symbol_attribute *attr, const c= har *name, locus *where) if (check_used (attr, name, where)) return false; + if (attr->contiguous) + { + duplicate_attr ("CONTIGUOUS", where); + return false; + } + attr->contiguous =3D 1; return gfc_check_conflict (attr, name, where); } diff --git a/gcc/testsuite/gfortran.dg/contiguous_12.f90 b/gcc/testsuite/g= fortran.dg/contiguous_12.f90 new file mode 100644 index 00000000000..9c477a7a06a =2D-- /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 =2D- 2.35.3 --sgnirk-b17cf5de-5a0c-43aa-85dc-9c699af51078--