Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ftc33-0003He-LQ for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Aug 2018 17:08:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ftc32-0006wG-0K for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Aug 2018 17:08:28 +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.89) (envelope-from ) id 1ftc31-0006w9-Pj for pgsql-hackers@lists.postgresql.org; Sat, 25 Aug 2018 17:08:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ftc2z-0001mw-9V for pgsql-hackers@lists.postgresql.org; Sat, 25 Aug 2018 17:08:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7PH8Irk016653; Sat, 25 Aug 2018 13:08:18 -0400 From: Tom Lane To: Andres Freund cc: Andrew Dunstan , Dave Page , David Steele , pgsql-hackers@lists.postgresql.org Subject: Re: C99 compliance for src/port/snprintf.c In-reply-to: <20180816160508.nd5u6fblr3jwcg6f@alap3.anarazel.de> References: <2069.1534363063@sss.pgh.pa.us> <20180815214931.vlwsz4s55enbppna@alap3.anarazel.de> <9877.1534371239@sss.pgh.pa.us> <20180815222401.kxsupl5zie2jgi4x@alap3.anarazel.de> <10675.1534372270@sss.pgh.pa.us> <20180816084134.sqggeatubeufpc2r@alap3.anarazel.de> <20180816111859.n6vtt322jpjwflij@alap3.anarazel.de> <20180816142220.yowdd6626c6mea5o@alap3.anarazel.de> <14429.1534434090@sss.pgh.pa.us> <20180816160508.nd5u6fblr3jwcg6f@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 16 Aug 2018 09:05:08 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16651.1535216898.1@sss.pgh.pa.us> Date: Sat, 25 Aug 2018 13:08:18 -0400 Message-ID: <16652.1535216898@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-08-16 11:41:30 -0400, Tom Lane wrote: >> Andres Freund writes: >>> While I'd personally have no problem kicking gcc 3.4 to the curb, I'm >>> still confused what causes this error mode. Kinda looks like >>> out-of-sync headers with gcc or something. >> Yeah, this is *absolutely* unsurprising for a non-native gcc installation >> on an old platform. > Sure, but that still requires the headers to behave differently between > C89 and C99 mode, as this worked before. But it turns out there's two > different math.h implementation headers, depending on c99 being enabled > (math_c99.h being the troublesome). If I understand correctly the > problem is more that the system library headers are *newer* (and assume > a sun studio emulating/copying quite a bit of gcc) than the gcc that's > being used, and therefore gcc fails. I have some more info on this issue, based on having successfully updated "gaur" using gcc 3.4.6 (which I picked because it was the last of the 3.x release series). It seems very unlikely that there's much difference between 3.4.3 and 3.4.6 as far as external features go. What I find in the 3.4.6 documentation is -- Built-in Function: double __builtin_inf (void) Similar to `__builtin_huge_val', except a warning is generated if the target floating-point format does not support infinities. This function is suitable for implementing the ISO C99 macro `INFINITY'. Note that the function is called "__builtin_inf", whereas what we see protosciurus choking on is "__builtin_infinity". So I don't think this is a version skew issue at all. I think that the system headers are written for the Solaris cc, and its name for the equivalent function is __builtin_infinity, whereas what gcc wants is __builtin_inf. Likewise, the failures we see for __builtin_isinf and __builtin_isnan are because Solaris cc provides those but gcc does not. If we wanted to keep protosciurus going without a compiler update, my thought would be to modify gcc's copy of math_c99.h to correct the function name underlying INFINITY, and change the definitions of isinf() and isnan() back to whatever was being used pre-C99. It's possible that newer gcc releases have been tweaked so that they make appropriate corrections in this header file automatically, but that's not a sure thing. regards, tom lane