Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePKmI-0004LZ-2B for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Dec 2017 04:05:46 +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 1ePKmF-00047d-H2 for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Dec 2017 04:05:43 +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 1ePKmF-00047T-5J for pgsql-hackers@lists.postgresql.org; Thu, 14 Dec 2017 04:05:43 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ePKm7-0000ib-Bi for pgsql-hackers@postgresql.org; Thu, 14 Dec 2017 04:05:41 +0000 Received: by mail-wm0-x229.google.com with SMTP id i11so8804897wmf.4 for ; Wed, 13 Dec 2017 20:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3zKmrmZin4UzoUpgDJQTyxlznVwFyzp6kmflcfk5Ywk=; b=Rfyzv7T1tA/xloObkNY3nGTj2k+3EtchPDIZscH1nU9t6BVLErM2elqjOwLR/mTXDO HU4xg0a1NymJnrTsySULRZf7dzNR/M3v/qGBLFWvKE1BZ8nInlBmlqU7yI3pe6LTuh5h lBIgkbFPCbDFQOa18jtT3NWkCgNdDujPsRujbH/XAjYHcUcYcFtrjVntSE/BbS3m62s2 kvQK5wnprPTo88WRNTSTJ5tBU7oTYQ5+Cgd2LfJWOKmFcw8QyiHbmuBETY4JyEo8QUIu 7u+KJ3kmqm+1dTPCz1uI9aGPlkSPkhDVLqRerFlpO03M8eVJEa2EhPpBLD4diwbyylIP 84Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3zKmrmZin4UzoUpgDJQTyxlznVwFyzp6kmflcfk5Ywk=; b=OmYw/Z9sok8rBEZKS0/LkH+82Fwqknek8oTbwt7ocjNTEYniw9KNkr8dIVg2U8f3ES gfQ+texmn3+DhuwhsPPd9Ycc/QVJpQw8F2xeqNfj6rueuks9d0y5TG/vOA2tPQVSlw9o r4Ay6stTx/N07xdwPmgIBazSdKRXnCngg7kuWQjlql6G8baWEw4NM2MYhwvfxZrggoF9 10x3hZyaqODjgs3jBHMU1oEtYuIKKwgvGLmUVfuczh7G8KOtxlDPzUwcCAEcupAbSXBS P36tgSuVZCh8l/1a2r/jfqJgjKajtiWBwV1TomQkHShVxhWuiaWHwIZna0mQbP4dnVz1 FB5A== X-Gm-Message-State: AKGB3mIvxFOcFx9m34S2jLu2U+5IdoPwi56mg9plRmWb1eRdxMA12o9w CkOB/r2KwKazNBl+RxOH/n7kJjuAC7WQy6yOe3E= X-Google-Smtp-Source: ACJfBovQ/2W7OIwu2pv6116FlKKaddp5/JREWTXQqTe+3fFH408AQ7ywVjJQ8kf3cQQ/Z7kHzAQIQh8mlumEQKWh2+E= X-Received: by 10.28.157.7 with SMTP id g7mr740512wme.99.1513224333542; Wed, 13 Dec 2017 20:05:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.157.137 with HTTP; Wed, 13 Dec 2017 20:05:32 -0800 (PST) In-Reply-To: <20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de> References: <20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de> From: Michael Paquier Date: Thu, 14 Dec 2017 13:05:32 +0900 Message-ID: Subject: Re: pgsql: Provide overflow safe integer math inline functions. To: Andres Freund Cc: PostgreSQL mailing lists Content-Type: multipart/mixed; boundary="001a114ba056de0531056044fece" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --001a114ba056de0531056044fece Content-Type: text/plain; charset="UTF-8" On Thu, Dec 14, 2017 at 6:37 AM, Andres Freund wrote: > 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. This uses clang 5.0 and I can reproduce the failure manually: $ clang --version clang version 5.0.0 (tags/RELEASE_500/final) Target: armv7l-unknown-linux-gnueabihf Thread model: posix InstalledDir: /usr/bin Note that on the same machine using gcc 7.2.0 I am seeing no compilation failures. ArchLinux maintainers can be sometimes wild in the versions they push, I have seen that in the past. And Arch ARM has less resources I think. Also, gull is complaining with the same failure: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=gull&dt=2017-12-13%2004%3A20%3A18 ARMv7 is used there as well, with clang 3.8, so this combination is deadly. > 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. The tests are run once per day to not push too much its SD card. Let me see... If I enforce also a cast on "result" as well then I am able to compile correctly, which gives me the attached. make check also works, I haven't taken the time to do a complete test run though, this would take way longer on dangomushi. -- Michael --001a114ba056de0531056044fece Content-Type: application/octet-stream; name="builtin-multi-conf.patch" Content-Disposition: attachment; filename="builtin-multi-conf.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_jb5ylmay0 ZGlmZiAtLWdpdCBhL2NvbmZpZy9jLWNvbXBpbGVyLm00IGIvY29uZmlnL2MtY29tcGlsZXIubT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