Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dO9M8-0003oG-IV for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Jun 2017 21:09:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dO9M8-0000jF-5F for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Jun 2017 21:09:36 +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 1dO9M7-0000g9-1J for pgsql-bugs@postgreSQL.org; Thu, 22 Jun 2017 21:09:35 +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.84_2) (envelope-from ) id 1dO9M4-0005X3-3U for pgsql-bugs@postgreSQL.org; Thu, 22 Jun 2017 21:09:34 +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 v5ML9TUR015143; Thu, 22 Jun 2017 17:09:29 -0400 From: Tom Lane To: "Tom Turelinckx" cc: pgsql-bugs@postgreSQL.org Subject: Re: Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc) In-reply-to: <002201d2eb94$c8bc8190$5a3584b0$@turelinckx.be> References: <006b01d2eaa2$d4317be0$7c9473a0$@turelinckx.be> <2069.1498062248@sss.pgh.pa.us> <000101d2eb5e$60a7ab60$21f70220$@turelinckx.be> <24675.1498141318@sss.pgh.pa.us> <001501d2eb78$e52a8e60$af7fab20$@turelinckx.be> <9547.1498157504@sss.pgh.pa.us> <002201d2eb94$c8bc8190$5a3584b0$@turelinckx.be> Comments: In-reply-to "Tom Turelinckx" message dated "Thu, 22 Jun 2017 22:18:58 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15141.1498165769.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 22 Jun 2017 17:09:29 -0400 Message-ID: <15142.1498165769@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org "Tom Turelinckx" writes: >> Maybe you could extract those bits too? Or if you prefer, just send me = the whole .s files off-list. > Whole .s files attached. Thanks. The short of it seems to be that this is a compiler bug. In the "original" code, the out-of-line segment at .LL726 is .loc 1 4415 0 ldsb [%g4], %g4 .LL726: cmp %g4, 48 bne,pt %icc, .LL715 andcc %g2, 64, %g0 ld [%g3+4], %g4 cmp %g4, 0 be,pt %icc, .LL715 andcc %g2, 64, %g0 ld [%fp-24], %g4 cmp %g4, 0 be,pn %icc, .LL727 add %l7, -2, %g3 <--- trashes %g3 ldsb [%g4], %g4 cmp %g4, 46 bne,a,pt %icc, .LL748 xor %l7, 6, %g2 .loc 1 4417 0 ba,pt %xcc, .LL715 <--- returns to .LL715 which needs %g3 andcc %g2, 64, %g0 The corresponding part in the "patched" code is .LL693: .LLBE547: .LLBE578: .LLBB579: .LLBB556: .loc 1 4415 0 cmp %o7, 48 bne,pt %icc, .LL712 andcc %g3, 64, %g0 ld [%g4+4], %o7 cmp %o7, 0 be,pt %icc, .LL712 andcc %g3, 64, %g0 ld [%fp-24], %o7 cmp %o7, 0 be,a,pn %icc, .LL722 add %g1, -2, %g4 <--- store to %g4 is annulled if no branch ldsb [%o7], %o7 cmp %o7, 46 bne,a,pt %icc, .LL722 add %g1, -2, %g4 <--- store to %g4 is annulled if no branch .loc 1 4417 0 ba,pt %xcc, .LL712 <--- returns to .LL712 which needs %g4 andcc %g3, 64, %g0 In short, the compiler is trying to hoist the first instruction for line 4456 into the delay slot of that branch to .LL727, and it's getting it wrong. This would've been fine if the compiler had remembered to put the "a" (annul) flag on the branch instruction, but it forgot. I think you need to file a bug with the gcc maintainers. No idea if there's anything you can give them that's shorter than this full file, but maybe they won't care. As a short-term workaround, reducing the -O level might help. Or perhaps there's a different gcc version you could use? regards, tom lane --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs