pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: compiler warnings on the buildfarm
Date: Thu, 12 Jul 2007 23:40:42 +0100
Message-ID: <4696ADEA.1040804@enterprisedb.com> (raw)
In-Reply-To: <12639.1184279380@sss.pgh.pa.us>
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>
	<20070712213806.GE22973@alvh.no-ip.org>
	<4696A5F1.3010103@enterprisedb.com>
	<12639.1184279380@sss.pgh.pa.us>

Tom Lane wrote:
> Heikki Linnakangas <heikki@enterprisedb.com> writes:
>> Hmm. It looks like I get that warning on my laptop as well. I tracked it 
>> down to these two places:
> 
>> Line 209:
>>> while (ptr - GETARR(trg) < ARRNELEM(trg))
>>> {
>>> 	text	   *item = (text *) palloc(VARHDRSZ + 3);
>>> 	
>>> 	SET_VARSIZE(item, VARHDRSZ + 3);
>>> 	CPTRGM(VARDATA(item), ptr);
>>>>> 	d[ptr - GETARR(trg)] = PointerGetDatum(item);
>>> 	ptr++;
>>> }
> 
> I'll betcha the compiler is trying to optimize the repeated calculations
> of "ptr - GETARR(trg)" into a separate variable that it increments along
> with ptr.  Maybe it is getting it wrong, or maybe the assembler is just
> confused.  Does the warning go away if you dial down the -O level?

Yes, I don't get it with -O1 or -O0.

$ gcc --version
gcc (GCC) 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)

Hmm. Prerelease? This version came from debian/testing.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (66+ messages)  latest in thread

Message-ID: <4696ADEA.1040804@enterprisedb.com>
Permalink:  ../4696ADEA.1040804@enterprisedb.com/
Also on:    postgresql.org/message-id/4696ADEA.1040804@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: heikki@enterprisedb.com, tgl@sss.pgh.pa.us, alvherre@commandprompt.com, stefan@kaltenbrunner.cc
  Subject: Re: compiler warnings on the buildfarm
  In-Reply-To: <4696ADEA.1040804@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox