Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1durE0-0000ag-U6 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Sep 2017 02:28:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1durE0-0002Xk-FP for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Sep 2017 02:28:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1durCR-0008E0-Tq for pgsql-hackers@postgresql.org; Thu, 21 Sep 2017 02:26:48 +0000 Received: from mail-yw0-x232.google.com ([2607:f8b0:4002:c05::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1durCO-0004wH-Uv for pgsql-hackers@postgresql.org; Thu, 21 Sep 2017 02:26:46 +0000 Received: by mail-yw0-x232.google.com with SMTP id t127so3170330ywg.4 for ; Wed, 20 Sep 2017 19:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=88Xlw0erQEi/MsnphhEhLRmVAmDTuuJnxCwaSV/XlXk=; b=j0qmxbLTy8lf6JrIgHqTCCsUiGDw6Frh311YtEIYZ69tNZVOaawCVNLsB62YQ7c31c Y8ZUWj6nonPY20Asv4iaueMRbaLxdRd8sRPXGFZM4CQwlnUUpRKvLaYgPVcPnoO1/iay xJaFDu0Y/SRXUgkQbfDazkCdVA3DB//YlBgIBTtZYu6tzfx06+hgCTyL9lzH/ddhGmKq Do8xTFG6CZ4q+QwdbsSjT+tGu4y6cFumDdFyb5xTO384SfTvxGSEAjx+s0saiRDi12Mt NfRw2uSVvAgWhEC73W8n/l8x3nJei8b/WmGqWcF558aXxZ68WykeBbr1UJEvdJbrmTLS k4dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=88Xlw0erQEi/MsnphhEhLRmVAmDTuuJnxCwaSV/XlXk=; b=BKDE1tIR3z7hhZrjroTf54lYqG+9dFWnXBoS9hl3k2Ew1tc7TgP95tH42WA4SRFUOZ 58nzrqrhcu4tnrSmAhwvjAOGmeP2it/l7nTUXvqxTT60WfSX5wLUp5HshnY+I2XODwAM 7HJX5KHXaNHoAfz+OF+HwX7DAPHFiyAqYjqcmJTigbCKk4BwLDwYbAsowQEvdj1+5THX Ipvk77sO24VkrWLBgnLnUxbPdSBgE4uhjDxhSzxCQf2KX7zdMKbgABxH/BvQXy038tCg eHPEQVk2H8YX9YPLQ8KTEYB/rZB8DPnpvc8W0XVURz5Zbe8tn9zjuifWbLxgPtMsSS3s eKPw== X-Gm-Message-State: AHPjjUipzWrvXehn0EVDSGRbEwmoCAK8fIE052sJw0duw3lEHrdSl84X QJgfgdsCxJo834xRClk26zUHiwWlafglMq/6xIFsI7WGRklN725vstqMLRBJxbwXkSnpIy17ZbV Qv7yoTbesZrEHqX2BhiavLDtePaQNttwa2wDEXMq3Bul2HB/bfnaybs2O5R/CXoFGX7FntLbSxv 7sIqpktFCErqI2 X-Google-Smtp-Source: AOwi7QAovVBJ4LsSFTTNHNKuBXceVyE/AqT4uPrqD59hbMOQU51IpRSKCfY+JcLUrQtxwphC38hMhA== X-Received: by 10.37.173.14 with SMTP id y14mr553819ybi.27.1505960803631; Wed, 20 Sep 2017 19:26:43 -0700 (PDT) Received: from [192.168.10.146] ([98.122.175.38]) by smtp.gmail.com with ESMTPSA id z77sm159920ywd.31.2017.09.20.19.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 19:26:43 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: Windows warnings from VS 2017 To: Tom Lane Cc: PostgreSQL-development References: <8649.1505951694@sss.pgh.pa.us> Message-ID: Date: Wed, 20 Sep 2017 22:26:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-MW List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 09/20/2017 08:18 PM, Andrew Dunstan wrote: > > On 09/20/2017 07:54 PM, Tom Lane wrote: >> Andrew Dunstan writes: >>> It's also warning that it will copy 16 bytes to a 13 byte structure at >>> lines 518, 1293 and 1294 of src/backend/commands/dbcommands.c. I haven't >>> seen any ill effects of this so far, but it seems to indicate that >>> something is possibly amiss on this compiler with the MemSet macros. >> That's weird. Is it too stupid to figure out that the if() inside >> MemSet evaluates to constant false in these calls? It seems hard to >> see how it would realize that the loop will write 16 bytes if it doesn't >> propagate the constant value forward. >> >> However ... on some other compilers, I've noticed that the compiler seems >> more likely to make "obvious" deductions of that sort if the variables in >> question are marked const. Does it help if you do >> >> - void *_vstart = (void *) (start); \ >> - int _val = (val); \ >> - Size _len = (len); \ >> + void * const _vstart = (void *) (start); \ >> + const int _val = (val); \ >> + const Size _len = (len); \ >> >> >> I don't think there's any strong reason not to just do s/MemSet/memset/ >> in these calls and nearby ones, but it would be good to understand just >> what's wrong here. And why it's only showing up in that file; seems >> nearly certain that we have similar coding elsewhere. >> >> > > I'll test it. > Doesn't make a difference. I agree it would be good to understand what's going on. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers