Обсуждение: gcc 4.6 warnings in HEAD?

Поиск
Список
Период
Сортировка

gcc 4.6 warnings in HEAD?

От
Alvaro Herrera
Дата:
Hi,

I'm seeing a bunch of warnings I don't remember seeing before in the
master branch:

/pgsql/source/HEAD/src/backend/executor/execQual.c: In function 'GetAttributeByNum':
/pgsql/source/HEAD/src/backend/executor/execQual.c:1104:11: warning: the comparison will always evaluate as 'true' for
theaddress of 'tmptup' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/backend/executor/execQual.c: In function 'GetAttributeByName':
/pgsql/source/HEAD/src/backend/executor/execQual.c:1165:11: warning: the comparison will always evaluate as 'true' for
theaddress of 'tmptup' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/backend/executor/execQual.c: In function 'ExecEvalFieldSelect':
/pgsql/source/HEAD/src/backend/executor/execQual.c:3914:11: warning: the comparison will always evaluate as 'true' for
theaddress of 'tmptup' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c: In function 'comparetup_heap':
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c:2755:12: warning: the comparison will always evaluate as 'true'
forthe address of 'ltup' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c:2756:12: warning: the comparison will always evaluate as 'true'
forthe address of 'rtup' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c: In function 'copytup_heap':
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c:2787:17: warning: the comparison will always evaluate as 'true'
forthe address of 'htup' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c: In function 'readtup_heap':
/pgsql/source/HEAD/src/backend/utils/sort/tuplesort.c:2839:17: warning: the comparison will always evaluate as 'true'
forthe address of 'htup' will never be NULL [-Waddress]
 

These seem to have to do with calling the heap_getattr() macro with a
tuple in the stack (not a pointer).  I have a vague memory of seeing
this problem some time ago.


/pgsql/source/HEAD/src/interfaces/libpq/fe-connect.c: In function 'PQconndefaults':
/pgsql/source/HEAD/src/interfaces/libpq/fe-connect.c:832:6: warning: the comparison will always evaluate as 'false' for
theaddress of 'errorBuf' will never be NULL [-Waddress]
 
/pgsql/source/HEAD/src/interfaces/libpq/fe-connect.c: In function 'PQconninfoParse':
/pgsql/source/HEAD/src/interfaces/libpq/fe-connect.c:3962:6: warning: the comparison will always evaluate as 'false'
forthe address of 'errorBuf' will never be NULL [-Waddress]
 
In file included from /pgsql/source/HEAD/src/bin/psql/mainloop.c:425:0:
/pgsql/source/HEAD/src/bin/psql/psqlscan.l: In function 'psql_scan_slash_option':
/pgsql/source/HEAD/src/bin/psql/psqlscan.l:1532:9: warning: the comparison will always evaluate as 'false' for the
addressof 'output' will never be NULL [-Waddress]
 

I don't understand these three -- they look like a compiler bug.  This
is about PQExpBufferBroken being called on a buffer that cannot be null
('cause it's in the stack) but obviously it could still have zero
length.


1$ gcc --version
gcc (Debian 4.6.1-4) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


-- 
Álvaro Herrera <alvherre@alvh.no-ip.org>


Re: gcc 4.6 warnings in HEAD?

От
Peter Eisentraut
Дата:
On ons, 2011-08-10 at 12:37 -0400, Alvaro Herrera wrote:
> I'm seeing a bunch of warnings I don't remember seeing before in the
> master branch:
> 
> /pgsql/source/HEAD/src/backend/executor/execQual.c: In function
> 'GetAttributeByNum':
> /pgsql/source/HEAD/src/backend/executor/execQual.c:1104:11: warning: the comparison will always evaluate as 'true'
forthe address of 'tmptup' will never be NULL [-Waddress] 
 

Yes, these are new with gcc 4.6.  I have filed a bug about them:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48778

All the other new warnings introduced by gcc 4.6 should be cleaned up by
now in the 9.2 branch.  (There are more warnings in 9.1 whose fixes I
did not backpatch.)  I am personally using

make COPT="-Werror -Wno-error=address"

to build PostgreSQL for the time being.