Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dv0M8-0008VW-Jz for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Sep 2017 12:13:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dv0M6-0005MW-T0 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Sep 2017 12:13:22 +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 1dv0KZ-0002dj-2a for pgsql-hackers@postgresql.org; Thu, 21 Sep 2017 12:11:47 +0000 Received: from mail-yw0-x230.google.com ([2607:f8b0:4002:c05::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dv0KR-0001yG-L5 for pgsql-hackers@postgresql.org; Thu, 21 Sep 2017 12:11:45 +0000 Received: by mail-yw0-x230.google.com with SMTP id t127so3886658ywg.4 for ; Thu, 21 Sep 2017 05:11:39 -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=8+zndd7G952aawyryirlWOilV55vgkGQ4Ff8uP+/7hE=; b=t+zYoFJhsMzn3QcnmX8AUXlxUjNJUlfy4h/Oz3lZM/uwB4Cic6sEiTB8zXUapwydtC Bph6QTK6NntB2HCEXX5+G1D4OYvngrV0ZutQWsDHBip9WxO9ftpzGjbVhnwxOvg8Z8rh r5Cv5hfmPBQasOrVbXR+EZFEnybLY3kZL8CxBOUUMF/vz/AbuMDE0PhYp04TJoMXJbkf ultAVWbuW4EoMMdRc0DyA4VF2sqsFr7TDAXF4RNni1R47y5bfX8QmhDRHCYwWJkkcZFE LnwVkGQdHUqCuY3pUPPO+sqvzKRanrN1xad+N00K+a7UFDte5T3KHMPNsLBS23mt/rI6 Mu7Q== 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=8+zndd7G952aawyryirlWOilV55vgkGQ4Ff8uP+/7hE=; b=NIXIR1IaWggcNFcRYYzoxSM6ju+CWXDDiHacZL5x+6HzACNEVHWz7A2Aty1c1DxjhB M1JxT/cuMZD1fQgSZfnMNUkaqie3xiMYoTOIOKHhMgpubGv4GvkabhmGb4jjjMJ6pHid I6uKe3i0FvpJ7fBv5gQ9tRxVxOGBkDnX5eLT7WKgCQeFsonyfdn+80o0CIzZbHxSajWu W4EVdpBQLd5dKriLxMSpFIbSLKuOKwN3/7XYVov7OtJX03tY15vaFyh6QX2LfYwQ9aUE QtkECJnD+4VByZiOZlIug9R1hiGfnq1dWI7OUMUdpku3kF4/kef4E+s8LWSoILqoj9Eg xW7g== X-Gm-Message-State: AHPjjUiWqabZRaXwlK/HUWYpQy7qurOI/uX49oYhGgeFEpv/GpSAN1YP 6H57i/pGv73x61EdUiwlqlR4S36V8nOLcGq4EQr90XTiesBUKyoajYp2Uq3A/cusgYDiqVjKrM3 /kFaqTR7TLfSWPa1kgRfN67QI5Vddn4ME1RU2UjgFgZjmDWMX6Jx6tckRypQBdnG4P9hUBH/tx5 7v4EoQlwrzTpmh X-Google-Smtp-Source: AOwi7QAMEBrrl1l+1DD61n+xxbYKX9KwBUTUNwSu9UGEMRp2Q6jJA5zXMAysKUp4yPJnQ+hl5jTskA== X-Received: by 10.13.212.200 with SMTP id w191mr1464262ywd.132.1505995897002; Thu, 21 Sep 2017 05:11:37 -0700 (PDT) Received: from [192.168.10.146] ([98.122.175.38]) by smtp.gmail.com with ESMTPSA id g72sm478433ywe.26.2017.09.21.05.11.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Sep 2017 05:11:36 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: Windows warnings from VS 2017 To: Haribabu Kommi Cc: Tom Lane , PostgreSQL-development References: <8649.1505951694@sss.pgh.pa.us> Message-ID: Date: Thu, 21 Sep 2017 08:11:35 -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: 8bit 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/21/2017 02:53 AM, Haribabu Kommi wrote: > > > On Thu, Sep 21, 2017 at 12:26 PM, Andrew Dunstan > > wrote: > > > > 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. > > > These warnings are not produced when the build is run in DEBUG mode. > Because of this I didn't see these warning when I was working with VS > 2017. > > This may be an issue with VS 2017 compiler. > Yeah, it seems like it, particularly when identical code in another function in the same file doesn't generate a complaint. The speed of memset is hardly going to be the dominating factor in a 'CREATE DATABASE' command, so we could certainly afford to change to plain memset calls here. I'll see if I can find someone to report this to :-) 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