Message ID | 1493159225.3139.189.camel@cavium.com |
---|---|
State | New |
Headers | show
Return-Path: <gcc-patches-return-452161-incoming=patchwork.ozlabs.org@gcc.gnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wCHrn5kv5z9s5L for <incoming@patchwork.ozlabs.org>; Wed, 26 Apr 2017 08:27:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="sQ3TtaCB"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:reply-to:to:cc:date:content-type :mime-version; q=dns; s=default; b=FHtFx3zBrJ+sEyXPFzzaiBLh66rWt 7wwOV5OuKma/QHTlKKLk7sk0jamHz3IGLB8LcJSRv/9d7XJadmCICTetb8iUiKTf Zn4XUkSNlBCC/PZCSIT5GAGg01AEBS6vK44TLuNr1zbPcWpGePxVLa4tsgeKMZqF Ym3X582Pt803y8= 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 :message-id:subject:from:reply-to:to:cc:date:content-type :mime-version; s=default; bh=mJBM8SfRuOyz618jPxUvvlA4vWI=; b=sQ3 TtaCB1O46qPNc+NiWWgkEhU70Eq18pxq+z/qZfMDTUF8slQZvigLlIp1j1DHz9p8 OzgMrbR/47pWAcIWPC6/tvXakpmyGnhJ2OY7yUQ0DMAgZXXkkzfvaN5XDtMYKLIy osXUJw7cUL+5I3Hc8Pjzl84huwHV0DTQvsBvN+xc= Received: (qmail 101733 invoked by alias); 25 Apr 2017 22:27:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-patches.gcc.gnu.org> List-Unsubscribe: <mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-help@gcc.gnu.org> Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101723 invoked by uid 89); 25 Apr 2017 22:27:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*MI:189, H*M:189, H*r:15.1.1061.12 X-HELO: NAM02-CY1-obe.outbound.protection.outlook.com Received: from mail-cys01nam02on0050.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) (104.47.37.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Apr 2017 22:27:09 +0000 Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none; gcc.gnu.org; dmarc=none action=none header.from=cavium.com; Received: from sellcey-dt.caveonetworks.com (50.233.148.156) by DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Tue, 25 Apr 2017 22:27:08 +0000 Message-ID: <1493159225.3139.189.camel@cavium.com> Subject: [PATCH] Alias analysis of zero sized arrays From: Steve Ellcey <sellcey@cavium.com> Reply-To: sellcey@cavium.com To: gcc-patches <gcc-patches@gcc.gnu.org> Cc: Richard Biener <richard.guenther@gmail.com> Date: Tue, 25 Apr 2017 15:27:05 -0700 Content-Type: multipart/mixed; boundary="=-tFJNsz8MuIAEUQSPCXgO" Mime-Version: 1.0 X-ClientProxiedBy: MWHPR22CA0031.namprd22.prod.outlook.com (10.168.250.145) To DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad108dea-7a4b-4f9c-65b5-08d48c2a35f0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DM5PR07MB3468; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 3:FP48MW5KalFnf035xAH58P28bqavFVBYzbtpoVdQ5df7lTK4g1wvG+kV/YLa1mi+pRNtaamsJSOAoEPIdXL32mEyP8WfJyrwRFEOzyaK0E+OVAqyb3x/9Np8W9ps+CAHZs45FLbBr3OPXHogIR51Y72gTOQlVrTdHaiJ1CCHVTDSy9mD+iflWtqqpxhMfYm16HKxaPXg3JT98iKsaAPdZ8ur4ZewGUQiOe0bfhu69Qt6ZDqRW2e0vrxl7S+eDW1UYwbX814skysh988g9T65XD+rzaVOqfMLqVq8ESSSvTTSrCEGOUYs7fF6RNgsYDgsJdCHrzjBEYzlo8+ssO/zQQ==; 25:z2CP+AqAHbl/pwsxqHlBlY0z1uhHeVHoRyInKC4KNQD3hwzDO8DM0OXxjhZovZGLYY+kNOX6bCTMNvjUxbMywQ83NqOHSun0NcHKRXYZ0HHIV57pa+CNv1GW/IznDnpWJXiETyfxLFURsiUOMTnG6qGyQ3Xz8FbOadywIl/om+evNAdIdj555rXwRy6TMUpEuLR8JKTGulfSFmdYEIzx9YOE/BsyP0rouTVoyTpdfvhEElU1XsKYr7hX9nU5kemPd0TrrDQ4a/C9iOS7l3+gBhL+WUUnjZDrnKPQqQtGiJeQ+SNRcfaXJcLVHdVpPK1vWYO6bAf9nZmUkn9OG2OWWDJDXRMApinCF25IJy/CszYamGqr8wmJsTYJaZSnSHUfm30RNenx/w++ZlWH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B3468.namprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123555025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148); SRVR:DM5PR07MB3468; BCL:0; PCL:0; RULEID:; SRVR:DM5PR07MB3468; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 4:57ovzA9IGQDfHOF2yBHHdhwbnpfwNfb3qAKqiy+96uLSzpU5e+sqp1cx5Ymh5wTChCvNDnFapg6jjJ41gKH5OcV20FrrHgyB0Neebu8XJ/qNz1wisrXa81u/+AirPfiYcwrCIWoWK8okmkK8bDdLPAhC40TO/4tfHpeSklW0nSqhHG3pG/Xy7d50e9l6QpkcdCCuJT66t1pT0HWByQF0OCWCds69JeFw1ls7dLsptpXQBQ58NRQI+j3u0LIua+gXVzJy4YbQ/sIOAlKMJ69c9bXCVpdpheLA4TLOpAQhN4MRcqiaS7Y9M24yRqQdHHLsI/sekWYmUcjsq5exHIMzQAxinspECvRArta09x5Cq96Y+7lHnZCElASa3RQMcYJ1aGkR5fXPUq8nOpcaAVGyFmXRtuJJWsnxajXZTcoZBESU7GrIec/lrwCdq221E4x9/Nk2EV4Xcm/0oMfYwHSRBouir4j7SJ0gJVb0Pp04OvSnKQTpL/jIqFbmUpywTxDTvStHxfczj25j7iXGqTY8q5QVvLUNY/AvDnzl1PbrrIQLIU9Hh/4YZUbFqZQAxXMR5ag/ZU1fZm0bFi83VZUWoKQL4fJpg0chDgCCHXuCx3dlqvoJ9dUIMWxTk1/pE2BTQKSsTOY9wW2qpQilE9HkWuqtuZX0R1wqnP9F+EzjaifxWeiDW3e+5XcAh7SbFPOrU+OTYjCJ9ncou+8k1Fcpyv2z/e5LI5K9zskEcbaU4dApzAb1DiGezS98Wa2ro/hee1KNCSy7T3Q8cRh9H4cSzP5jICvDZNShnket4D92yhG4GkzM6VAf2KC6OjnryLwc X-Forefront-PRVS: 0288CD37D9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39840400002)(39410400002)(39400400002)(39850400002)(377424004)(110136004)(38730400002)(53936002)(66066001)(4810100001)(2906002)(33646002)(189998001)(6916009)(6666003)(5890100001)(36756003)(3450700001)(3846002)(53416004)(6116002)(43066003)(4326008)(568964002)(50226002)(103116003)(2476003)(5660300001)(512874002)(25786009)(4610100001)(7736002)(50986999)(305945005)(84326002)(6486002)(42186005)(6506006)(8676002)(81166006)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3468; H:sellcey-dt.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3468; 23:eSneEd6wK/w8MIQxLAU5FNsE1Cxx4xHn2+ML9KU/R?= =?us-ascii?Q?pD0yIiHSvj2sYOLPZwNKOwoYuuNR/9wh9vl0PcOT9YqP/bKPeHOavkIpGuQb?= =?us-ascii?Q?D2bWSHP/TaEKzA/aujOx3Po9ySnz1OCb2/FnQ7Mxni0Goylw9wW2n7CoT+P6?= =?us-ascii?Q?q5+PsnPokjoBH/kWna/RrWTxjN9dUMrbrSQB+XNkznxFWlH4PwXHgF85LE0V?= =?us-ascii?Q?Ymz/f9D0648qANrkZ8YJKCuH2F/xzG5xsRjVzC631EV+IiHtMBJv3wvIanrG?= =?us-ascii?Q?zXAZRmDJJKh6m5y5iXu9OjhS8/4eV4eJwyuBr73aadDNFLOaN6TO05hVp6DC?= =?us-ascii?Q?N6sjrdmkU8ufkwT+eXDvrQ551Cwx6a4p4SXxO/Xf86e3G23afiXhSMZCOEIb?= =?us-ascii?Q?tM7D/Lm+zcGwIXdaEfEEDsL9mlrHbzUOGVULd4s8SIXFM47Pu5W2Dosc7HgD?= =?us-ascii?Q?i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u5HJVeFrCA7HCzb55iViv2HiuV58nJPw3b2YKPRgrTawCHFzxpDIUQx+/FldFkc1/7lgDM9Mg5UNMfxs5b3M0Sz2s+4qqRv/9vNAvahk3mFpddw+f7aupVX2J4VPz/6ht2bUF2LSj6immcNLMAtnnp+yv+enYihnrYdOsu022X2jdAj6NmwdBb2T00YYs3W5c7BTbtDH9YW85X+iAOfpmJLNaBNbhDk2gFSLkoJZweiobTl3jS8P9VinGgwhVdQEpkAjv9lw4SG+mcIWw+D7c2/JYz2y6r9vXF/1g/gPTN7wkCqVmDA8qm/STdlCR6oBGA==; 5:4zZW2iRbf8tkTVl5gKIUg3jWiCCmz0qPaDg5V6ACfb/epOGmq1/RrI0dWCs9+QPmRSqtew2gLyataeeRPlOZOv0a5MKk+Cp0OEUZWZgZ3MA6nzxc57wzVztkEjDp0Y3VwR/K4r7al68wMd1/3vxLGg==; 24:F4a1uJZlO4pTmQFTJRkd4QtyDw7XLxo14rt//xQQ9rYQyh6d+1rA7JrGE1eQe6MVChqbNXiu49oXXZkhmZ7hEKiQZ9MRW7vPgbstPADQZM8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 7:OtYwbYD2UgtDQD7fKidan63zLW8oXOp9lHMxkUmDErfmrdhE5uTHnB/JGC93EeLXL0wAlyaKCSGk0LkPipmc1m5qVuvnxObPHvMGCpJ6G/7cZIkC7aEbNswwZtZgS3UPtlLODulMi4EO2RWcdMUxh7elHB+zV9ajY4jFvz8Lx3JFNEbXXrbfWVQ0DMNz3BOf1Z+kW6hhZvGuRwdTy5vFZFTPzYKiukK3Hvc4+Pazb+QSsQzqhO8quE11EdsrWSGKA+4N0Z0LQCFCciNkAWXjqXJ15a8tA5rzVsmjwR7T5WsOXe+1ga9wYKpyIX2xjAOrmYl78MwxtVTdGBTJkvCFFA== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2017 22:27:08.4888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3468 |
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 8ee46dc..79c3489 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -438,6 +438,10 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, && TREE_CODE (size_tree) == INTEGER_CST) bitsize = wi::to_offset (size_tree); + /* If zero sized array, treat it like a flexible array. */ + if (bitsize == 0) + bitsize = -1; + /* Initially, maxsize is the same as the accessed element size. In the following it will only grow (or become -1). */ maxsize = bitsize; @@ -504,7 +508,13 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, if (maxsize != -1 && csize && TREE_CODE (csize) == INTEGER_CST) - maxsize = wi::to_offset (csize) - bit_offset; + { + maxsize = wi::to_offset (csize) - bit_offset; + + /* If zero sized array, treat it like a flexible array. */ + if (maxsize == 0) + maxsize = -1; + } else maxsize = -1; }