Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 631F69FB43D for ; Thu, 12 Jul 2007 18:57:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 30462-10 for ; Thu, 12 Jul 2007 18:57:07 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from oxford.xeocode.com (unknown [87.127.95.194]) by postgresql.org (Postfix) with ESMTP id D795A9F9F7D for ; Thu, 12 Jul 2007 18:57:10 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1I96eh-0001WI-OH; Thu, 12 Jul 2007 22:56:59 +0100 From: Gregory Stark To: "Heikki Linnakangas" Cc: "Alvaro Herrera" , "Stefan Kaltenbrunner" , "Tom Lane" , "PostgreSQL-development" Subject: Re: compiler warnings on the buildfarm In-Reply-To: <46969C98.60207@enterprisedb.com> (Heikki Linnakangas's message of "Thu, 12 Jul 2007 22:26:48 +0100") Organization: EnterpriseDB References: <46962BBD.5000108@kaltenbrunner.cc> <17428.1184249229@sss.pgh.pa.us> <469653BA.2040004@kaltenbrunner.cc> <20070712211918.GD22973@alvh.no-ip.org> <46969C98.60207@enterprisedb.com> X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.hackers" 11299) Date: Thu, 12 Jul 2007 22:56:59 +0100 Message-ID: <87d4yx70b8.fsf@oxford.xeocode.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/350 X-Sequence-Number: 105265 "Heikki Linnakangas" writes: > Alvaro Herrera wrote: >> Stefan showed me via Jabber this warning: >> >> /tmp/ccM7MfqX.s: Assembler messages: >> /tmp/ccM7MfqX.s:703: Warning: 00000003fffffffc shortened to 00000000fffffffc >> /tmp/ccM7MfqX.s:738: Warning: 00000003fffffffc shortened to 00000000fffffffc >> >> He says that this comes from trgm_op.c file. I don't get the warning >> myself obviously, so I started guessing. I've occasionally seen this warning too. It seems to be pretty random though. Nor have I been able to find any actual problems caused by it. But istm this has to be a compiler bug since any overflow in the C code should be handled (and potentially warned) by the compiler long before the assembler gets to see it. >> So the upper 2 bits are being lost (the second number is 32 bits wide). >> >> The only thing that I think is related is the usage of VARSIZE(). It >> looks like 0x3FFFFFFF (actual constant in the toast code) is shift two >> bits left. I can see no such operation though. > > The shift is in postgres.h, SET_VARSIZE_4B. I have no idea where that warning is > coming from, though. What's the real source behind "ccM7MfqX.s"? Huh. I wonder. Could the compiler be incorrectly optimizing cases of SET_VARSIZE(new_datum VARSIZE(olddatum)) which amounts to: ((olddatum >> 2) & 0x3FFFFFFF) << 2 If it does constant propagation without handling overflow it could end up with: (olddatum >> 2 << 2) & 0x3FFFFFFFC note that in fact truncating the high two bits as the assembler did would in fact be the correct thing to do here which would explain why it doesn't cause any actual problems. Also note that it doesn't require an actual single statement of the form above. The compiler could be doing constant propagation from an earlier statement. Code which calls VARSIZE(olddatum) and then passes the result to SET_VARSIZE(newdatum,len) is quite common. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com