Re: PostgreSQL 8.2 (from CVS devel) first impressions

From: mark(at)mark(dot)mielke(dot)cc
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL 8.2 (from CVS devel) first impressions
Date: 2006-11-05 16:30:14
Message-ID: 20061105163014.GA7995@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 05, 2006 at 11:01:40AM -0500, Neil Conway wrote:
> On Sun, 2006-11-05 at 01:15 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> > Compiled fine. Still a few warnings (using Fedora Core 6 / AMD64).
> Presumably those are just the standard warnings we can't easiy
> eliminate. If not, can you post them please?

They all appear harmless. For the uninitialized warnings, the compiler
is not able to prove that tm2timestamp, numericvar_to_int8, or
cost_bitmap_tree_node always stores to the final argument and does not
fetch from the final argument. An '= 0' would get rid of each of the
warnings, and might simplify some code (that does conditional
assignment to 0), although perhaps the goal is to improve performance
and avoid an assignment to '= 0' if not necessary.

I suspect initialization would have no measurable performance impact,
and would improve the maintainability of the code. One more warning
that people don't become trained to ignore. If tm2timestamp ever
did not assign to the final argument, the value would be zero, and
not random data from the stack.

For the label warning, I think it might be generated by bison/yacc,
and no REJECT rule is used?

I don't know about the nbtinsert.c warnings. It looks like part of a
structure is initialized, and then the structure is used. A little odd.

I've included them all below. Pretty few for an open source project. :-)

Cheers,
mark

gcc -O3 -march=athlon64 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wde
claration-after-statement -Wendif-labels -fno-strict-aliasing -I../../../../src/
include -D_GNU_SOURCE -c -o nbtinsert.o nbtinsert.c
nbtinsert.c: In function ‘_bt_insertonpg’:
nbtinsert.c:1065: warning: ‘state.best_delta’ may be used uninitialized in this
function
nbtinsert.c:1065: warning: ‘state.newitemonleft’ may be used uninitialized in th
is function
nbtinsert.c:1065: warning: ‘state.firstright’ may be used uninitialized in this
function

gcc -O3 -march=athlon64 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wde
claration-after-statement -Wendif-labels -fno-strict-aliasing -I../../../../src/
include -D_GNU_SOURCE -c -o costsize.o costsize.c
costsize.c: In function ‘cost_bitmap_or_node’:
costsize.c:707: warning: ‘subselec’ may be used uninitialized in this function
costsize.c:706: warning: ‘subCost’ may be used uninitialized in this function
costsize.c: In function ‘cost_bitmap_and_node’:
costsize.c:663: warning: ‘subselec’ may be used uninitialized in this function
costsize.c:662: warning: ‘subCost’ may be used uninitialized in this function
costsize.c: In function ‘cost_bitmap_heap_scan’:
costsize.c:514: warning: ‘indexSelectivity’ may be used uninitialized in this fu
nction
costsize.c:513: warning: ‘indexTotalCost’ may be used uninitialized in this func
tion

gcc -O3 -march=athlon64 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wde
claration-after-statement -Wendif-labels -fno-strict-aliasing -I../../../../src/
include -D_GNU_SOURCE -c -o numeric.o numeric.c
numeric.c: In function ‘numericvar_to_int4’:
numeric.c:1777: warning: ‘val’ may be used uninitialized in this function
numeric.c: In function ‘numeric_int2’:
numeric.c:1867: warning: ‘val’ may be used uninitialized in this function
numeric.c: In function ‘numeric_int8’:
numeric.c:1820: warning: ‘result’ may be used uninitialized in this function

gcc -O3 -march=athlon64 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wde
claration-after-statement -Wendif-labels -fno-strict-aliasing -I../../../../src/
include -D_GNU_SOURCE -c -o timestamp.o timestamp.c
timestamp.c: In function ‘timestamptz_zone’:
timestamp.c:4388: warning: ‘result’ may be used uninitialized in this function
timestamp.c: In function ‘timestamptz_timestamp’:
timestamp.c:4356: warning: ‘result’ may be used uninitialized in this function
timestamp.c: In function ‘timestamp2timestamptz’:
timestamp.c:4323: warning: ‘result’ may be used uninitialized in this function
timestamp.c: In function ‘timestamp_zone’:
timestamp.c:4215: warning: ‘result’ may be used uninitialized in this function
timestamp.c: In function ‘timestamptz_trunc’:
timestamp.c:3254: warning: ‘result’ may be used uninitialized in this function
timestamp.c: In function ‘SetEpochTimestamp’:
timestamp.c:1424: warning: ‘dt’ may be used uninitialized in this function
timestamp.c: In function ‘timestamptz_part’:
timestamp.c:1424: warning: ‘dt’ may be used uninitialized in this function
timestamp.c: In function ‘timestamp_part’:
timestamp.c:3799: warning: ‘timestamptz’ may be used uninitialized in this funct
ion
timestamp.c:1424: warning: ‘dt’ may be used uninitialized in this function
timestamp.c: In function ‘timestamp_in’:
timestamp.c:1424: warning: ‘dt’ may be used uninitialized in this function
timestamp.c: In function ‘timestamptz_in’:
timestamp.c:1424: warning: ‘dt’ may be used uninitialized in this function

gcc -O3 -march=athlon64 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wde
claration-after-statement -Wendif-labels -fno-strict-aliasing -Wno-error -pthrea
d -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -I../include -I../../.
./../src/interfaces/ecpg/include -I. -DMAJOR_VERSION=4 -DMINOR_VERSION=2 -DPATCH
LEVEL=1 -I../../../../src/include -D_GNU_SOURCE -c -o preproc.o preproc.c
In file included from preproc.y:6776:
pgc.c: In function ‘yylex’:
pgc.c:1570: warning: label ‘find_rule’ defined but not used

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2006-11-05 16:43:11 Re: [HACKERS] Bug in WAL backup documentation
Previous Message Tom Lane 2006-11-05 16:29:06 Re: Proposal: vacuum and autovacuum parameters to control freezing