Re: Replace plain-memory ordered array by binary tree in ts_stat() function.

Started by Peter Eisentrautover 17 years ago4 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

The patch mentioned in the subject leaves this compiler warning:

tsvector_op.c: In function ‘insertStatEntry’:
tsvector_op.c:815: warning: ‘res’ may be used uninitialized in this function

I took a quick look but it is not immediately obvious whether the
compiler might actually have a point here. Could you please fix this?

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#1)

The patch mentioned in the subject leaves this compiler warning:

tsvector_op.c: In function ‘insertStatEntry’:
tsvector_op.c:815: warning: ‘res’ may be used uninitialized in this function

I took a quick look but it is not immediately obvious whether the
compiler might actually have a point here. Could you please fix this?

#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Peter Eisentraut (#1)
Re: Re: Replace plain-memory ordered array by binary tree in ts_stat() function.

Fixed, but my gcc didn't emit such message.

The patch mentioned in the subject leaves this compiler warning:

tsvector_op.c: In function ‘insertStatEntry’:
tsvector_op.c:815: warning: ‘res’ may be used uninitialized in this
function

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Teodor Sigaev (#3)
Re: Re: Replace plain-memory ordered array by binary tree in ts_stat() function.

Teodor Sigaev <teodor@sigaev.ru> writes:

Fixed, but my gcc didn't emit such message.

That's not actually too surprising. gcc's "uninitialized variable"
analysis is per-function, which means that its scope can change
depending on how much inlining the compiler chooses to do.
So you can see different warnings at different -O levels or on
different platforms.

Also, I think you don't get any such warnings at all at -O0 ...
which is why I always use at least -O1 even in debug builds.

regards, tom lane