Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQMsM-0003Yt-Or for pgsql-committers@arkaria.postgresql.org; Sun, 17 Dec 2017 00:32:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQMsK-0002Em-CF for pgsql-committers@arkaria.postgresql.org; Sun, 17 Dec 2017 00:32:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eQMsJ-0002Ec-WF for pgsql-committers@lists.postgresql.org; Sun, 17 Dec 2017 00:32:16 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eQMsE-0003UJ-RQ for pgsql-committers@postgresql.org; Sun, 17 Dec 2017 00:32:15 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id AC99120C77; Sat, 16 Dec 2017 19:32:08 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sat, 16 Dec 2017 19:32:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=l2PDjBvlPIC/7JnL5S072xLY/5e7u Pn5E2tfgsquWL8=; b=C1BfnSJBk/JZfpFPACEt9ItfRrfsP/tHTcqkki3A6D8pI YbhiQ8wAJd9GEkPXx8+Cu7sH0zlJDleFZnP/4e96YXe81EOlnES9ytOwp7u8hl4G EB1429Uws2mZzdINq3m8SlOcmFbhA5fURvtH0CYidce4Ar248pRkh449i89ZLk7m 0EtkzpUL5Y+UY1rbr+Pdbka76/g7jxFAfVz2xlak071q4xDW7jgbnXNVwFmu3CTQ h0T8kFQptSAj1gUus1QR8JSYnChI/ryCnxlqwxBhQBZPj4tm7rdAzjW5wGwBysgz tWMCTbkVbErnDGau1aAUm4ChRh7VDDy+jc4NlfJtg== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 30B7F7E347; Sat, 16 Dec 2017 19:32:08 -0500 (EST) Date: Sat, 16 Dec 2017 16:32:07 -0800 From: Andres Freund To: pgsql-committers@postgresql.org, Michael Paquier Subject: Re: pgsql: Provide overflow safe integer math inline functions. Message-ID: <20171217003207.3myeahkbsm63kbvl@alap3.anarazel.de> References: <20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2017-12-13 13:37:54 -0800, Andres Freund wrote: > Hi Michael, > > On 2017-12-13 01:01:19 +0000, Andres Freund wrote: > > Provide overflow safe integer math inline functions. > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dangomushi&dt=2017-12-13%2018%3A00%3A18 > > which seems half like a compiler bug to me. But either way, we gotta > work around it. I suspect the reason configure test doesn't > sufficiently detect this here is because it's testing the function with > constant arguments. > > Could you perhaps test whether replacing PGAC_C_BUILTIN_OP_OVERFLOW's body with something like > result > PG_INT64_TYPE a; > PG_INT64_TYPE b; > PG_INT64_TYPE result; > __builtin_mul_overflow(*(volatile PG_INT64_TYPE*) &a, *(volatile PG_INT64_TYPE*) &b, &result); > > makes it fail? I'd rather not test this via the buildfarm, given that > dangomushi isn't the most frequently running / fastest animal. I've since tried this via the buildfarm, but still: configure:14480: checking for __builtin_mul_overflow configure:14500: ccache clang -o conftest -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -O2 -D_GNU_SOURCE -I/usr/include/et conftest.c -lssl -lcrypto -lz -lreadline -lrt -lcrypt -ldl -lm >&5 configure:14500: $? = 0 configure:14508: result: yes I'm not quite following. Could you check if the same happens without -O2? Not because that'd be a solution, but to narrow down how this happens? Greetings, Andres Freund