From patchwork Thu Jul 5 02:17:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 939618 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-481023-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Ibb3bCMi"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cR8DPPiG"; 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 41LhMp4zQcz9s3C for ; Thu, 5 Jul 2018 12:17:41 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=I4YvZ/NfRe4HHuq32iLE25oNQ0cCgut+mMlBzyrqT8S4NSUBndFN3 pG2lReyuyFDL4UocrbXW+MYIhbEmpRWfzorQtMUfJaJJ/wZ5Gydskwi2+tdDh5jK sxe9qPD/jmIMBGunHzrq0j2TAvKJqEHHfBzdCIWUSsq9InUCZGht5U= 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:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=dIYJy61rg/kJWO8dcPpVEO8Hltc=; b=Ibb3bCMi95eYexckiF6D tvnYROu4WIPC6WyheXVpl1VXLVmhs5JUld+K/rc6Wfx3sz+BEvrAI0wHY2TMj1ij vQmW5jKZiPU4Gx+xUpADc0LfW81cydewS9KRsSEXvL/ZMh/Kjb4HZ9aP6R9QtqST w/rcIesFtqkJOl+WYNvZxJc= Received: (qmail 74742 invoked by alias); 5 Jul 2018 02:17:28 -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 74252 invoked by uid 89); 5 Jul 2018 02:17:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f45.google.com Received: from mail-oi0-f45.google.com (HELO mail-oi0-f45.google.com) (209.85.218.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jul 2018 02:17:17 +0000 Received: by mail-oi0-f45.google.com with SMTP id n84-v6so13851831oib.9 for ; Wed, 04 Jul 2018 19:17:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version; bh=adbz2GKQPxFtAiovFYygi78MGlf+oKaJVbZIWtwOgJI=; b=cR8DPPiG/dY3bXzzUlplbKWLj12iu0IvfVBKC0rH5Dr2QT6ZFOTr8YV8J3FYaN1ung SoyEL0M0zzw5fDRX+NelHx/5OJF7b4CplPlSPSfeLNx1GszuAjIOU3d0YVLMtujimVNC nN624E6Gg6ySzppnSiHC1a7qd65MtI54QS3Vc2nwoD5RnfIt0lWVfTXvbIH1VCEE68C/ 2aFF9ikCy86YTR19rpl4dr+LIOpenoX671dLGsM6OmVHHB3XTDyEsss2f8Sy5KFe/FOJ uviweXhQVfboByX5+gOb6P/0if5jxsbLBPpoQIrdp1qItRQQUEw+P6FUoj1jqVkW3+L7 AnAA== Received: from localhost.localdomain (75-166-107-65.hlrn.qwest.net. [75.166.107.65]) by smtp.gmail.com with ESMTPSA id 203-v6sm6112907oic.28.2018.07.04.19.17.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 19:17:13 -0700 (PDT) From: Martin Sebor Subject: [PATCH] use TYPE_SIZE instead of TYPE_DOMAIN to compute array size (PR 86400) To: Gcc Patch List Message-ID: <351e6b7f-4f16-fd67-2228-72d938dc1f56@gmail.com> Date: Wed, 4 Jul 2018 20:17:11 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-IsSubscribed: yes A change of mine to the strlen pass assumes that the strlen argument points to an object of the correct type and does not correctly handle GIMPLE where the argument has the wrong type such as in: extern char a[1][2]; n = strlen (*a); where the strlen pass actually sees n = strlen (a); The attached patch corrects the code to use TYPE_SIZE to determine the size of the array argument rather than using TYPE_DOMAIN. Tested on x86_64-linux. Martin PR tree-optimization/86400 - set::set::set