Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kRpjV-0001z5-PD for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Oct 2020 04:46:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kRpjU-0000UU-FC for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Oct 2020 04:46:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kRpjU-0000Op-06 for pgsql-hackers@lists.postgresql.org; Mon, 12 Oct 2020 04:46:48 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kRpjR-0005Zj-Kn for pgsql-hackers@lists.postgresql.org; Mon, 12 Oct 2020 04:46:47 +0000 Received: by mail-pf1-x434.google.com with SMTP id e10so12418580pfj.1 for ; Sun, 11 Oct 2020 21:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QKe7Sn+LqFCs4pW0gW8yQNgPWgJqVfPfy0w1CdWyahs=; b=SzFPVTnTm1fYdiQ4hbFnKBLpZ5cNIojcfn59nsLonZOGwJ5oXiJ5rkgsnCQdzTjKjM kZdshGduaMNLUUxZtPEx9EVN8XlchH7EDUHH3d0P6AgOp/b0FyW4l8AT3fMwuEwpMXsB UIZuoSmwT34rSNrq7lVlHumjgGiRTbO+t7bCg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QKe7Sn+LqFCs4pW0gW8yQNgPWgJqVfPfy0w1CdWyahs=; b=lJkRkTl++Fzxb5iIY2A7/sEvQCyYpnAIYFV75L0pir/ZrTooM28RRhlkthCvNE8xb+ gG/foBUYNFabNn1ezGpiIo4HCzgxpJshnkSMjRck7+t67Jq6k3NBgOoOMYnIIx5xUfjT kkxgH45hGndx/7gA6/qCCJmmSoWHAzarCWT6wPX6jcZ/SKF2yHfy+9knBSielwCz+3Yf 665E2tKH6UdNcnKU4lZDt/77J85meQfzDnfl6jFsNTAlctxwhMlLBsQVzrzueRA9F6A+ 2OqZU4rGrUN/c7OG2VM6nS3+UcV+56Z0xDu1v0FQB2t9qZeMMUSAqLpYz/WIj1l3Sli0 wwmQ== X-Gm-Message-State: AOAM5311/9bLRXP9kYjWHpEj7LXsAR38SEybYFHfnYOTLy58GZtlrtmM bi2spdGtgI0Sfy/yUzlVoCh/uQ== X-Google-Smtp-Source: ABdhPJy+J7FwRY452kE9sdEoBGsDg6JChkTaz6gGjs3owoQX4T0Fidi0MZOA8tp4u/ZVedADglUDKw== X-Received: by 2002:a17:90a:dc0c:: with SMTP id i12mr18885591pjv.67.1602478003242; Sun, 11 Oct 2020 21:46:43 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::43]) by smtp.gmail.com with ESMTPSA id e5sm23704265pjd.0.2020.10.11.21.46.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 21:46:42 -0700 (PDT) Date: Sun, 11 Oct 2020 21:46:40 -0700 From: Noah Misch To: Tom Lane Cc: Christoph Berg , pgsql-hackers@lists.postgresql.org Subject: Re: powerpc pg_atomic_compare_exchange_u32_impl: error: comparison of integer expressions of different signedness (Re: pgsql: For all ppc compilers, implement compare_exchange and) fetch_add Message-ID: <20201012044640.GA1793921@rfd.leadboat.com> References: <20201009092825.GD889580@msg.df7cb.de> <20201009100117.GA1550390@rfd.leadboat.com> <20201011051043.GA1724101@rfd.leadboat.com> <3006140.1602436360@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3006140.1602436360@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Oct 11, 2020 at 01:12:40PM -0400, Tom Lane wrote: > Noah Misch writes: > > The first attachment fixes the matter you've reported. While confirming that, > > I observed that gcc builds don't even use the 64-bit code in arch-ppc.h. > > Oops. The second attachment fixes that. > > I reviewed these, and tested the first one on a nearby Apple machine. > (I lack access to 64-bit PPC, so I can't actually test the second.) > They look fine, and I confirmed by examining asm output that even > the rather-old-now gcc version that Apple last shipped for PPC does > the right thing with the conditionals. Thanks for reviewing and for mentioning that old-gcc behavior. I had a comment asserting that gcc 7.2.0 didn't deduce constancy from those conditionals. Checking again now, it was just $SUBJECT preventing constancy deduction. I made the patch remove that comment. > > I plan not to back-patch either of these. > > Hmm, I'd argue for a back-patch. The issue of modern compilers > warning about the incorrect code will apply to all supported branches. > Moreover, even if we don't use these code paths today, who's to say > that someone won't back-patch a bug fix that requires them? I do not > think it's unreasonable to expect these functions to work well in > all branches that have them. Okay, I've pushed with a back-patch. compare_exchange-ppc-immediate-v1.patch affects on code generation are limited to regress.o, so it's quite safe to back-patch. I just didn't think it was standard to back-patch for the purpose of removing a -Wsign-compare warning. (Every branch is noisy under -Wsign-compare.) atomics-ppc64-gcc-v1.patch does change code generation, in the manner discussed in the big arch-ppc.h comment (starts with "This mimics gcc"). Still, I've accepted the modest risk.