From patchwork Tue Nov 7 10:24:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 16334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp174670vqo; Tue, 7 Nov 2023 03:44:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGy0Y5Un9I01jyCt62viEtShgJgs125GHF1xo+dBZ/MNK5B9pNH2e5B78UG0SCMN2GipA6R X-Received: by 2002:a05:622a:190b:b0:41b:7774:9566 with SMTP id w11-20020a05622a190b00b0041b77749566mr3298579qtc.2.1699357469775; Tue, 07 Nov 2023 03:44:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699357469; cv=pass; d=google.com; s=arc-20160816; b=RFhcHVeQczkEarxPQAps1TE+oQ34TygSOOJjRBvDUZ1dpY8fZVXklcQVikW1/FTFf+ PYhA4nBCLbG0M2+73KJmWmiQqTXnmACkDFPqujkpfz2k1hzNFPsEP68SGKvSY8kMpfjr Idus90cP3bIjRivmyQ9uGXOwfw9Ex6NKhhbP5EiAFUOgJhERAzdeJql/wmGV5LD/3rRA 3D4UUkvCnRjvN+v7ie1XNBShKxp+ENrqbUPXa5klcFy+kLEOy8jCiCFbxDl1Ju7f6N/G sAkfXfX72nIX9bcO0GYmIKtXj5azMp+cvppLhOLRGQDvb+/vKpjvbsTuzSfaHXjg+zB5 qC6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=kZJYvgaLRFOpSKJgtHEs/hI15gAtMATiDJ5JcCiKEyk=; fh=zSP9Z/xOHj5SuUPPVSStTox2VGm+p0Uo644NtF/AZic=; b=TbN3ohybEZ3ov3azko8QtYGKeofEtkloFjIsNZFnByViYLxcEZO2AWdE70gvVUiFjO CbJ4/8nAN/PcV4jaf9kV49sYe3zieTc8xwZ/4AhQNFIWXuPP3MBlLI5eg8ZErVBGY9SR 6D+56+Oy595LufDFqxpEvXuWpF5xLEkhsOcJvAg8gH2WySRtR8tAkVt3RVx+LhH3SaNK u3kmPtkCU3d8BEiwoMkFjxEhPRuC9qetZDKQ5ZetHBcdXWgk1kcD+zAJ9jIOKFKpBZ2z EeCJFpmb7XUKzynZt+sqXsHi7rYTlb0kelWZ1/A1h96s+qh1JDK/WoDJrkpu25nF5KO7 +Ylw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GL9ZMlde; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EgZhH8ku; arc=pass (i=1); 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h9-20020a05622a170900b0041b7773ee44si6720309qtk.443.2023.11.07.03.44.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 03:44:29 -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=GL9ZMlde; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EgZhH8ku; arc=pass (i=1); 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 9DEA83881D25 for ; Tue, 7 Nov 2023 10:25:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DEA83881D25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699352700; bh=kZJYvgaLRFOpSKJgtHEs/hI15gAtMATiDJ5JcCiKEyk=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=GL9ZMldecLREjsNK5WNWIajXUUpN/AMch9LZWwdJ1z8Hw4Lf3CNtxKhKLI7yKe1sI NdswsEKbSoholPFpfa0vzwO+4inQ+lBMOM2aSL6QwlUn8cBFU5V0VZIfB1MaRVuC9Z zbJudyZSNUS1zzOeuOdEvWMRoOUF9Xwa9BwUtIms= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) by sourceware.org (Postfix) with ESMTPS id C0E89385C6DF for ; Tue, 7 Nov 2023 10:24:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C0E89385C6DF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C0E89385C6DF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=80.12.242.30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699352654; cv=none; b=ioiHmrTtseNtP2RvMXScRtSlpsFyuHMLy/k8ihqhLDWR9T8PrEFmOVoMg8Dm0B/TSGv+l453zl6RFBdDvg+jmztG9yQxxZ4oSLC23gRSR+OzdxAQWQfaDy4y6fe/h9Y5EaV9fX3W2hWFrIyyuYkNpogVa8jtyOajc+fPtvHQ/vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699352654; c=relaxed/simple; bh=mwClfiU0yizbRelhAE7r8O0CcPXdYbHqshsErCJu6K0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KGtJ4GU0gyKnsWGTtWxfINEorhvSuI2dgz0oKCY/oOlnirdqsHy17Y8UestENyUtMXNELrWUBgCTTIvYdtUHruKNaXO7CYPYMrNGhbpUKY/w2zBEopQkmWBwGQo3Ic/vlChUJt4vlgKhNMRraZlRazzVOsbsV9fR30ZjP8HBE80= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from cyrano.home ([86.215.161.51]) by smtp.orange.fr with ESMTPA id 0JFcrynXNF6ta0JFirgDC6; Tue, 07 Nov 2023 11:24:10 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1699352650; bh=kZJYvgaLRFOpSKJgtHEs/hI15gAtMATiDJ5JcCiKEyk=; h=From:To:Subject:Date; b=EgZhH8kuifyFYBqMbEDz3Ltr8G1oqb23YI1wefI5WanG+WPWNmpIKNaVpap6dqbqp oxQq71ABjf2XjlZHtDlTe5TVVeVl28mDFRV9nnJxrD5wJrBU7JoK9lDf22KSO/PM9Z FglJr+N79k4xon87trB9IhmtJWpJWMw8pa2Im2eA6FAnp6k2wOiBH7xpNGaRTSArSw AC8ysELDvAicA641el4yKOjJdkcwUeCwyD5mFk+1TWNnn8IlA+QfcBH7ri0X2O7lzj eDjLI3E4VSmwJO4YkS2qxBr2iSq4F4aw1sZrEypucOfZI9heK9C+JpaEe3m34vLEVo IPd/oPhXhNvKA== X-ME-Helo: cyrano.home X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Tue, 07 Nov 2023 11:24:10 +0100 X-ME-IP: 86.215.161.51 From: Mikael Morin To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH v2 0/3] libgfortran: empty array fixes Date: Tue, 7 Nov 2023 11:24:01 +0100 Message-ID: <20231107102404.1723120-1-mikael@gcc.gnu.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781905457764208794 X-GMAIL-MSGID: 1781905457764208794 Hello, Harald's review of the previous version [1] of these patches spotted a possible misbehaving case in one patch, and a latent bug in the area of the second patch. So here is the second try, bootstraped and regression tested on x86_64-pc-linux-gnu. OK for master? Mikael [1]: https://gcc.gnu.org/pipermail/fortran/2023-November/059896.html https://gcc.gnu.org/pipermail/gcc-patches/2023-November/635305.html Changes from version 1: * Add patch 1/3 to the series fixing the unallocated empty result issue. * In patch 2/3 (formerly 1/2) clamp negative extent to zero. Mikael Morin (3): libgfortran: Don't skip allocation if size is zero [PR112412] libgfortran: Remove early return if extent is zero [PR112371] libgfortran: Remove empty array descriptor first dimension overwrite [PR112371] gcc/testsuite/gfortran.dg/allocated_4.f90 | 195 +++++++ gcc/testsuite/gfortran.dg/bound_10.f90 | 207 ++++++++ gcc/testsuite/gfortran.dg/bound_11.f90 | 588 ++++++++++++++++++++++ libgfortran/generated/all_l1.c | 9 +- libgfortran/generated/all_l16.c | 9 +- libgfortran/generated/all_l2.c | 9 +- libgfortran/generated/all_l4.c | 9 +- libgfortran/generated/all_l8.c | 9 +- libgfortran/generated/any_l1.c | 9 +- libgfortran/generated/any_l16.c | 9 +- libgfortran/generated/any_l2.c | 9 +- libgfortran/generated/any_l4.c | 9 +- libgfortran/generated/any_l8.c | 9 +- libgfortran/generated/count_16_l.c | 9 +- libgfortran/generated/count_1_l.c | 9 +- libgfortran/generated/count_2_l.c | 9 +- libgfortran/generated/count_4_l.c | 9 +- libgfortran/generated/count_8_l.c | 9 +- libgfortran/generated/findloc1_c10.c | 18 +- libgfortran/generated/findloc1_c16.c | 18 +- libgfortran/generated/findloc1_c17.c | 18 +- libgfortran/generated/findloc1_c4.c | 18 +- libgfortran/generated/findloc1_c8.c | 18 +- libgfortran/generated/findloc1_i1.c | 18 +- libgfortran/generated/findloc1_i16.c | 18 +- libgfortran/generated/findloc1_i2.c | 18 +- libgfortran/generated/findloc1_i4.c | 18 +- libgfortran/generated/findloc1_i8.c | 18 +- libgfortran/generated/findloc1_r10.c | 18 +- libgfortran/generated/findloc1_r16.c | 18 +- libgfortran/generated/findloc1_r17.c | 18 +- libgfortran/generated/findloc1_r4.c | 18 +- libgfortran/generated/findloc1_r8.c | 18 +- libgfortran/generated/findloc1_s1.c | 18 +- libgfortran/generated/findloc1_s4.c | 18 +- libgfortran/generated/iall_i1.c | 30 +- libgfortran/generated/iall_i16.c | 30 +- libgfortran/generated/iall_i2.c | 30 +- libgfortran/generated/iall_i4.c | 30 +- libgfortran/generated/iall_i8.c | 30 +- libgfortran/generated/iany_i1.c | 30 +- libgfortran/generated/iany_i16.c | 30 +- libgfortran/generated/iany_i2.c | 30 +- libgfortran/generated/iany_i4.c | 30 +- libgfortran/generated/iany_i8.c | 30 +- libgfortran/generated/iparity_i1.c | 30 +- libgfortran/generated/iparity_i16.c | 30 +- libgfortran/generated/iparity_i2.c | 30 +- libgfortran/generated/iparity_i4.c | 30 +- libgfortran/generated/iparity_i8.c | 30 +- libgfortran/generated/maxloc1_16_i1.c | 30 +- libgfortran/generated/maxloc1_16_i16.c | 30 +- libgfortran/generated/maxloc1_16_i2.c | 30 +- libgfortran/generated/maxloc1_16_i4.c | 30 +- libgfortran/generated/maxloc1_16_i8.c | 30 +- libgfortran/generated/maxloc1_16_r10.c | 30 +- libgfortran/generated/maxloc1_16_r16.c | 30 +- libgfortran/generated/maxloc1_16_r17.c | 30 +- libgfortran/generated/maxloc1_16_r4.c | 30 +- libgfortran/generated/maxloc1_16_r8.c | 30 +- libgfortran/generated/maxloc1_16_s1.c | 30 +- libgfortran/generated/maxloc1_16_s4.c | 30 +- libgfortran/generated/maxloc1_4_i1.c | 30 +- libgfortran/generated/maxloc1_4_i16.c | 30 +- libgfortran/generated/maxloc1_4_i2.c | 30 +- libgfortran/generated/maxloc1_4_i4.c | 30 +- libgfortran/generated/maxloc1_4_i8.c | 30 +- libgfortran/generated/maxloc1_4_r10.c | 30 +- libgfortran/generated/maxloc1_4_r16.c | 30 +- libgfortran/generated/maxloc1_4_r17.c | 30 +- libgfortran/generated/maxloc1_4_r4.c | 30 +- libgfortran/generated/maxloc1_4_r8.c | 30 +- libgfortran/generated/maxloc1_4_s1.c | 30 +- libgfortran/generated/maxloc1_4_s4.c | 30 +- libgfortran/generated/maxloc1_8_i1.c | 30 +- libgfortran/generated/maxloc1_8_i16.c | 30 +- libgfortran/generated/maxloc1_8_i2.c | 30 +- libgfortran/generated/maxloc1_8_i4.c | 30 +- libgfortran/generated/maxloc1_8_i8.c | 30 +- libgfortran/generated/maxloc1_8_r10.c | 30 +- libgfortran/generated/maxloc1_8_r16.c | 30 +- libgfortran/generated/maxloc1_8_r17.c | 30 +- libgfortran/generated/maxloc1_8_r4.c | 30 +- libgfortran/generated/maxloc1_8_r8.c | 30 +- libgfortran/generated/maxloc1_8_s1.c | 30 +- libgfortran/generated/maxloc1_8_s4.c | 30 +- libgfortran/generated/maxval1_s1.c | 30 +- libgfortran/generated/maxval1_s4.c | 30 +- libgfortran/generated/maxval_i1.c | 30 +- libgfortran/generated/maxval_i16.c | 30 +- libgfortran/generated/maxval_i2.c | 30 +- libgfortran/generated/maxval_i4.c | 30 +- libgfortran/generated/maxval_i8.c | 30 +- libgfortran/generated/maxval_r10.c | 30 +- libgfortran/generated/maxval_r16.c | 30 +- libgfortran/generated/maxval_r17.c | 30 +- libgfortran/generated/maxval_r4.c | 30 +- libgfortran/generated/maxval_r8.c | 30 +- libgfortran/generated/minloc1_16_i1.c | 30 +- libgfortran/generated/minloc1_16_i16.c | 30 +- libgfortran/generated/minloc1_16_i2.c | 30 +- libgfortran/generated/minloc1_16_i4.c | 30 +- libgfortran/generated/minloc1_16_i8.c | 30 +- libgfortran/generated/minloc1_16_r10.c | 30 +- libgfortran/generated/minloc1_16_r16.c | 30 +- libgfortran/generated/minloc1_16_r17.c | 30 +- libgfortran/generated/minloc1_16_r4.c | 30 +- libgfortran/generated/minloc1_16_r8.c | 30 +- libgfortran/generated/minloc1_16_s1.c | 30 +- libgfortran/generated/minloc1_16_s4.c | 30 +- libgfortran/generated/minloc1_4_i1.c | 30 +- libgfortran/generated/minloc1_4_i16.c | 30 +- libgfortran/generated/minloc1_4_i2.c | 30 +- libgfortran/generated/minloc1_4_i4.c | 30 +- libgfortran/generated/minloc1_4_i8.c | 30 +- libgfortran/generated/minloc1_4_r10.c | 30 +- libgfortran/generated/minloc1_4_r16.c | 30 +- libgfortran/generated/minloc1_4_r17.c | 30 +- libgfortran/generated/minloc1_4_r4.c | 30 +- libgfortran/generated/minloc1_4_r8.c | 30 +- libgfortran/generated/minloc1_4_s1.c | 30 +- libgfortran/generated/minloc1_4_s4.c | 30 +- libgfortran/generated/minloc1_8_i1.c | 30 +- libgfortran/generated/minloc1_8_i16.c | 30 +- libgfortran/generated/minloc1_8_i2.c | 30 +- libgfortran/generated/minloc1_8_i4.c | 30 +- libgfortran/generated/minloc1_8_i8.c | 30 +- libgfortran/generated/minloc1_8_r10.c | 30 +- libgfortran/generated/minloc1_8_r16.c | 30 +- libgfortran/generated/minloc1_8_r17.c | 30 +- libgfortran/generated/minloc1_8_r4.c | 30 +- libgfortran/generated/minloc1_8_r8.c | 30 +- libgfortran/generated/minloc1_8_s1.c | 30 +- libgfortran/generated/minloc1_8_s4.c | 30 +- libgfortran/generated/minval1_s1.c | 30 +- libgfortran/generated/minval1_s4.c | 30 +- libgfortran/generated/minval_i1.c | 30 +- libgfortran/generated/minval_i16.c | 30 +- libgfortran/generated/minval_i2.c | 30 +- libgfortran/generated/minval_i4.c | 30 +- libgfortran/generated/minval_i8.c | 30 +- libgfortran/generated/minval_r10.c | 30 +- libgfortran/generated/minval_r16.c | 30 +- libgfortran/generated/minval_r17.c | 30 +- libgfortran/generated/minval_r4.c | 30 +- libgfortran/generated/minval_r8.c | 30 +- libgfortran/generated/norm2_r10.c | 7 +- libgfortran/generated/norm2_r16.c | 7 +- libgfortran/generated/norm2_r17.c | 7 +- libgfortran/generated/norm2_r4.c | 7 +- libgfortran/generated/norm2_r8.c | 7 +- libgfortran/generated/parity_l1.c | 7 +- libgfortran/generated/parity_l16.c | 7 +- libgfortran/generated/parity_l2.c | 7 +- libgfortran/generated/parity_l4.c | 7 +- libgfortran/generated/parity_l8.c | 7 +- libgfortran/generated/product_c10.c | 30 +- libgfortran/generated/product_c16.c | 30 +- libgfortran/generated/product_c17.c | 30 +- libgfortran/generated/product_c4.c | 30 +- libgfortran/generated/product_c8.c | 30 +- libgfortran/generated/product_i1.c | 30 +- libgfortran/generated/product_i16.c | 30 +- libgfortran/generated/product_i2.c | 30 +- libgfortran/generated/product_i4.c | 30 +- libgfortran/generated/product_i8.c | 30 +- libgfortran/generated/product_r10.c | 30 +- libgfortran/generated/product_r16.c | 30 +- libgfortran/generated/product_r17.c | 30 +- libgfortran/generated/product_r4.c | 30 +- libgfortran/generated/product_r8.c | 30 +- libgfortran/generated/sum_c10.c | 30 +- libgfortran/generated/sum_c16.c | 30 +- libgfortran/generated/sum_c17.c | 30 +- libgfortran/generated/sum_c4.c | 30 +- libgfortran/generated/sum_c8.c | 30 +- libgfortran/generated/sum_i1.c | 30 +- libgfortran/generated/sum_i16.c | 30 +- libgfortran/generated/sum_i2.c | 30 +- libgfortran/generated/sum_i4.c | 30 +- libgfortran/generated/sum_i8.c | 30 +- libgfortran/generated/sum_r10.c | 30 +- libgfortran/generated/sum_r16.c | 30 +- libgfortran/generated/sum_r17.c | 30 +- libgfortran/generated/sum_r4.c | 30 +- libgfortran/generated/sum_r8.c | 30 +- libgfortran/m4/ifindloc1.m4 | 18 +- libgfortran/m4/ifunction-s.m4 | 30 +- libgfortran/m4/ifunction-s2.m4 | 30 +- libgfortran/m4/ifunction.m4 | 30 +- libgfortran/m4/ifunction_logical.m4 | 9 +- 191 files changed, 2094 insertions(+), 3754 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/allocated_4.f90 create mode 100644 gcc/testsuite/gfortran.dg/bound_10.f90 create mode 100644 gcc/testsuite/gfortran.dg/bound_11.f90