gcc 4.6 warnings in HEAD?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: gcc 4.6 warnings in HEAD?
Date: 2011-08-10 16:37:13
Message-ID: 1312993813-sup-9503@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 the address 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 the address 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 the address 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' for the 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' for the 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' for the 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' for the 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 the address 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' for the 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 address of '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(at)alvh(dot)no-ip(dot)org>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-08-10 16:41:51 Re: Reduced power consumption in autovacuum launcher process
Previous Message Heikki Linnakangas 2011-08-10 16:34:23 Re: Enforcing that all WAL has been replayed after restoring from backup