Re: compiler warnings on the buildfarm

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

Alvaro Herrera wrote:
> Heikki Linnakangas wrote:
>> 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.
>>> 3FFFFFFFC = 1111111111111111111111111111111100
>>> FFFFFFFC = 11111111111111111111111111111100
>>> 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"?
>
> trgm_op.c
>
> I'm not sure that the shift in SET_VARSIZE_4B is applicable here,
> because it would have to be passed a len of FFFFFFFF.

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++;
> }

Line 224:
> ptr = GETARR(trg);
> while (ptr - GETARR(trg) < ARRNELEM(trg))
> {
>>>>> pfree(DatumGetPointer(d[ptr - GETARR(trg)]));
> ptr++;
> }

The warning seems to be in related array indexing. If you replace ptr -
GETARR(trg) with a constant, the warning goes away. But having "i = ptr
- GETARR(trg)" in there doesn't give a warning.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-07-12 22:29:40 Re: compiler warnings on the buildfarm
Previous Message Gregory Stark 2007-07-12 21:56:59 Re: compiler warnings on the buildfarm