From patchwork Wed Sep 20 12:15:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 113110 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp694262qgf; Wed, 20 Sep 2017 05:15:46 -0700 (PDT) X-Received: by 10.99.105.130 with SMTP id e124mr1980037pgc.420.1505909746060; Wed, 20 Sep 2017 05:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505909746; cv=none; d=google.com; s=arc-20160816; b=awKfJSpnGxDw826u/q/kUrCaaiSAwDps8ZxkgF8BAPljtxv+UH3ciT7YBGvGVBueKT aECm9zPwf+iE2jldR7NdHQr7EDQN6MsGHKlDDuwLEA84nVXnI3gTdYFwlQYCYynp6a23 m/9SLKVu5BXwXOvwKUeox+F+SaXqp8r07IpszV1njPiMuVWx69qaDyrt4v6RJ48LKOn8 RudA42fkBBWvtVCDb3zibsWZZkNb/wzNNUXZ89GCuTBVUiV8fkEcU45o/R+ZK5JezKNs BSXhBrQno0z/W3/dLTcn53sAK6j2AhOPYUUB93icuaax0b2eUEAklz/SJrNmP3IVm9YT BerA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=H1mNDmsrja6k3AzMYQT8mNZl2Cph9KwnwuJraOselyg=; b=iP0dQTp7OnZ3JFrDBfZvJiSP7dOfNCTCyCvyTCQByKDznYRbtpkzIhS2eN/f71cc6b 8Jlotk8m66/lIEszj7ac2dy43lLg6a2JVNVK9x5BR90J931EfjeM70RPeJtsemeGZKfs qeTaWHsa9ZmAXujp4EpAEzrNrMgB6FcL6OkXSfOoY89mqqmrlsA9KGMYsVf1OMg7u590 TwBccd4P/9IkFhbApLJZd/lLG7RHv9I0xvrpPTbjdWrSP9nuk7V3KzlTj/MOLpKJE24u qDemIkNH0AtG/Qf4K7jSjnco6MPK/CeShHPeTE7U0xwXf8+NjtBiW9ig79WHNey5zrN5 62Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=AwBetnua; spf=pass (google.com: domain of gcc-patches-return-462579-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-462579-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g8si1266565plt.320.2017.09.20.05.15.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 05:15:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-462579-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=AwBetnua; spf=pass (google.com: domain of gcc-patches-return-462579-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-462579-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=vaWb7dP36NvBuRs0/4d+4DF/yD9ekX5VbCmYpg+XCl7Nrr5ciVMR8 XxJz6w8TD6Ws7S4qTZLPBlJprM144A2Hfuvn4JZhdH/Cy3vR8CWafYuopx2T/0v/ JmYR3Z12g6yv1vCk0Vw1+c39WxpMsRvd6qOpT7fPMD6zgRXV8Ab+Tk= 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 :to:subject:date:message-id:mime-version:content-type; s= default; bh=/t7DVDUAXPyE2rdZYHg9SASZnIE=; b=AwBetnuaSfUkw74VhOIK s2VZKuneQTDoAE0e/2/nmOsIbufpF7mV7rigCBttC55iVSOy4qCBlxW0tg+waJcx vVU6Des1YOEsYb/RHwYIDDrXUcHRnN4/LNyO3mu1uBTtXCEgGssWT40E7kme6Zkb 8f4j0ooFQ90kNsKv5EtA7ks= Received: (qmail 17441 invoked by alias); 20 Sep 2017 12:15:32 -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 15246 invoked by uid 89); 20 Sep 2017 12:15:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1083, protect X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Sep 2017 12:15:30 +0000 Received: by mail-wm0-f48.google.com with SMTP id 13so6617047wmq.2 for ; Wed, 20 Sep 2017 05:15:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=H1mNDmsrja6k3AzMYQT8mNZl2Cph9KwnwuJraOselyg=; b=PhztRJ9iJJZ4IbN8g/REW9IuBw2cSQf6NEY0usxj6RM23ItBpY/UaBZ5fQ41eK+kGE oZ6OLTiG/xHofNRy6oBPkD5eXNGS70UYVUJjY7a9RekO6DAGXMbwocuL2IV1MQuZVKY1 ViSD90xmfHJFyhYvFj0yK+z2DpwSP4vLWBjJ27MnS9IpOJowpLalYNNRLN8DMJu7cKP2 z2w/SzMnmcUY8QbvTPTYkg+sznJQoz9S0vcjwqEyTmfly7KmfqoAsJwLMYthYPoYucQR 07U/xZUpTG4Xroj/3hTfplm6P8569wX9nkTdujSv62m3L+b5p+TG6MUr5WuSbiCLksoX T85A== X-Gm-Message-State: AHPjjUgmk8XsLNYTRli/fETqXmqyBoYe14VO5Nk8yaCR91Cbd+8IcEKm iRvpNVekyZsFurKSJ8E957qw9sbNhK4= X-Google-Smtp-Source: AOwi7QBMyIQl1SBgALN1arYER2VIcStNprEChBvT4wBL+tGw5dXgxYjTaYxiZUru3SWWlkPjMdX+eA== X-Received: by 10.28.216.75 with SMTP id p72mr4113584wmg.128.1505909722673; Wed, 20 Sep 2017 05:15:22 -0700 (PDT) Received: from localhost (92.40.248.127.threembb.co.uk. [92.40.248.127]) by smtp.gmail.com with ESMTPSA id j15sm1557634wre.87.2017.09.20.05.15.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Sep 2017 05:15:21 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Fix unguarded uses of tree_to_uhwi Date: Wed, 20 Sep 2017 13:15:19 +0100 Message-ID: <87fubh1s88.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch uses tree_fits_uhwi_p to protect a previously unguarded use of tree_to_uhwi. Without this we would ICE for variable-sized types. Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linus-gnu. OK to install? Richard 2017-09-20 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree.c (find_atomic_core_type): Check tree_fits_uhwi_p before calling tree_to_uhwi. Index: gcc/tree.c =================================================================== --- gcc/tree.c 2017-09-14 16:45:44.199522746 +0100 +++ gcc/tree.c 2017-09-20 13:13:43.953534150 +0100 @@ -5821,11 +5821,10 @@ find_atomic_core_type (tree type) tree base_atomic_type; /* Only handle complete types. */ - if (TYPE_SIZE (type) == NULL_TREE) + if (!tree_fits_uhwi_p (TYPE_SIZE (type))) return NULL_TREE; - HOST_WIDE_INT type_size = tree_to_uhwi (TYPE_SIZE (type)); - switch (type_size) + switch (tree_to_uhwi (TYPE_SIZE (type))) { case 8: base_atomic_type = atomicQI_type_node;