gcc 4.6 warnings in HEAD? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject gcc 4.6 warnings in HEAD?
Date
Msg-id 1312993813-sup-9503@alvh.no-ip.org
Whole thread Raw
Responses Re: gcc 4.6 warnings in HEAD?
List pgsql-hackers
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>


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Enforcing that all WAL has been replayed after restoring from backup
Next
From: Tom Lane
Date:
Subject: Re: Reduced power consumption in autovacuum launcher process