From patchwork Mon Jan 16 20:38:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 44308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1390559wrn; Mon, 16 Jan 2023 12:39:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsxh9Ifydp2KutnIB5SZgiy+MOdoK+ICodqTCV/zXXR2LiFcf8wXrOQixcnrIgvmv758z1z X-Received: by 2002:a05:6402:c41:b0:499:d0e3:7745 with SMTP id cs1-20020a0564020c4100b00499d0e37745mr764118edb.14.1673901581727; Mon, 16 Jan 2023 12:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673901581; cv=none; d=google.com; s=arc-20160816; b=KQ8ye6x3kymBEGQIA7SjzalKU8CPYkXQGgC6BN1ItYm0jFL6KK3KBPX3hhvsHiBOOb ANX1o0nxHF0bMzMNW+AaNxZ3NgZKCl75MRBTv22mB3j2rMbP1tgGNStHIcZ0PhIEdVCO UaywV5JjbFfJPQzv1v4IBgd3uL4OFvkIJqYajB31bjwpi1qANPmp+eN8qnmMQuhPxiov RIjgBFmpOAhE/LcmplPKxjJbGJ4aYAfpb22S7AFy+dY6+Lq0b3QbDKRop0wQSGQ0r8ET iiWphV1sCAY7MeaGuUHT71FtAVlxro4YCMxyFDsCtZRzuqnIXD+GBdzC1r5C8dFgjdqD 23ng== 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=sd+3T4zWGNM6fB3VsQCQqAhivI1LrYNo/g8AT3vOGxQ=; b=RxkxC4UEincZGE7md3ESe/BS5sboql+bYO/OA5Vud6G3wNdIVy0H6y7dpNRC0SYljE jVQMERF1JYxzw4ciM+qPdxJSmZlQ81dV71MDAiuNwzevGKwHdVECWsxNv1lJK+94u1Qk 0OytPDsj30shQG553v4I6FMb4G33kMtmyfZKg0Z29LHfxDXaO2pQ9bS+dYHr4/TQibgn xqXys6OGKwwISGwS9SIWA8o17VLlqPCL6egSZnABFLSVr1EpcuJMEqUA5gBK3GMl3PaV aXvjJ2Zb8bSnt6Ft1sHjX3FwQw939r9eszpUc02f2JpWsrXI9Zqp0zlZtohlngaB8EoG axvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rTzXmWx8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g11-20020a056402180b00b0048f7f747aedsi26737503edy.226.2023.01.16.12.39.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 12:39:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rTzXmWx8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 89AC3385841E for ; Mon, 16 Jan 2023 20:39:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89AC3385841E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673901580; bh=sd+3T4zWGNM6fB3VsQCQqAhivI1LrYNo/g8AT3vOGxQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rTzXmWx8Nggq0lBHuxkH1EzUGDW+ghkUlaUdqGxyReynmbLMMd2z9Y1lHsNU+/Mae wWz6Co+KMCA3pVjAFgm92MUBS848QotO896yzmZSooqHBh01b1RUpRAeoi1lLKY/Fb tH6B5B4VDkQv/stEYP4+Hqg1kxSRV3kM7brNW+M0= 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.15.19]) by sourceware.org (Postfix) with ESMTPS id 2D8E43858D32; Mon, 16 Jan 2023 20:38:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D8E43858D32 X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [93.207.89.104] ([93.207.89.104]) by web-mail.gmx.net (3c-app-gmx-bs50.server.lan [172.19.170.103]) (via HTTP); Mon, 16 Jan 2023 21:38:55 +0100 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH] Fortran: fix ICE in get_expr_storage_size [PR108421] Date: Mon, 16 Jan 2023 21:38:55 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:KLpPEcrpzE0740C9FGbtrhCkDUwbpCHE5ltB5rMNHW4hNnxw00eMcuT5PcfH74y6kPt3X cJ6+WUAzpF2mrcI0KN2dUwYyyWXwU1X1c1wihXNY18yapv2LCMuYswKCbnfBfgYYLklnYR06XDOP vPDWQ9WsjmzFDPKfyl4HVZBjp0a8dl6ueWa0WoyD9qDHwMONqqSRNTJPth9CfOqytBoZtZYbk8XB E8EUQ4P0gqkpJo90cbnq4g5tnBpKSZIL45Sn4K1/4y6mDc5qQf0t+wY8/VCf6NdlhyiMRJn3M/RN Fc= UI-OutboundReport: notjunk:1;M01:P0:eRy4v18tcq4=;2hoHgYfHXMEbLLITefBpnfNogzE 2i281zNSndrSRl8/RbCjzjUEYmbkRoaE28akAeA6jLP/T/zRrtoVXjXmq4knmr6XIKrRwPQ5I 4lGRexN/son6Zow6CLJogJLzJKaIbyjv9Pg4xbPScNImUG+6XOoaySbPZgJnukUDfd/RxdW9H 2ZGRdPeQC13ZRu6hV4YpIhsyh/v7KqT4LPkZN2EAvTCp3Dk515+9N+YeXyZ7fKqZj796uIeHf V7TRefizBM6osdxPK1MySu9aCOBRd6hEZnko8ghT+FyH7/QDZ63Gb61DIvR4c31gzRsPYa2qq gMs5dj2INRAknboXbcchUw9TtCOolm18GArQVtz2hK5hmIat59m/dAdPJiziirge8yqEW0sY/ rBPTf32BWrUNFyByc7q32FC41oL5Ta9ho61q3BJAqV7AItG/+olAXl/k1unfvCgHD7090wDVg FmKtuaB8VOopFXg/NpdM9OQAuJQZub9OLlyv9tAQGpXSNwE9Zxwe2j0y572l/odb/0YrsevzV j3yRKCU6Giv+gAMFAO2lKgYlOw0CX9vQcZitumQ770eWq8weXnK9OzWCd63INc9uZ24UEBh+c 0or+ktQ00GO7hbKlDgju/GhNxqFtfHKBIIc4G/loipCv0h8GbJWYILyl9p+14Kz7tL5P5mxrx ggoL0mmkVkbi/GTV1g3gvVNA4xM7axB3dCSKSv+bed6oPd+6LGfDXQp216yC9j81p1Z3f0luf JQNTXc+QgCY49M57pynPJmt/XDvy51t/29gXBgsNeeTjO6EMiJZj7W42y1uJQoLwfGZVPVXr6 BoAN2VRRRSwkzcm+PreiJPIS7hcadW8lPWxCYXPgiyKb4= X-Spam-Status: No, score=-13.1 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 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?1755213024991251300?= X-GMAIL-MSGID: =?utf-8?q?1755213024991251300?= Dear all, here's an obvious patch for an ICE-on-invalid where we missed a check that we actually have an integer length before trying to extract a usable value. Regtested on x86_64-pc-linux-gnu. I intend to commit it to mainline within the next 24h unless there are comments. Cheers, Harald diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index c4f7faaf597..307082b048d 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -2858,6 +2858,7 @@ get_expr_storage_size (gfc_expr *e) if (e->ts.type == BT_CHARACTER) { if (e->ts.u.cl && e->ts.u.cl->length + && e->ts.u.cl->length->ts.type == BT_INTEGER && e->ts.u.cl->length->expr_type == EXPR_CONSTANT) strlen = mpz_get_si (e->ts.u.cl->length->value.integer); else if (e->expr_type == EXPR_CONSTANT