Re: compiler warnings on the buildfarm

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: compiler warnings on the buildfarm
Date: 2007-07-12 22:50:45
Message-ID: 4696B045.8080405@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Heikki Linnakangas <heikki(at)enterprisedb(dot)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?

FWIW, this patch makes the warnings go away, and makes the code a little
bit more readable as well. It would be nice to understand why exactly
it's complaining, though.

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

Attachment Content-Type Size
trgm-silence-warning.patch text/x-diff 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-07-12 23:03:11 Re: compiler warnings on the buildfarm
Previous Message Tom Lane 2007-07-12 22:45:16 Re: compiler warnings on the buildfarm