On Mon, Mar 30, 2020 at 9:36 PM Andres Freund <[email protected]> wrote:
> This triggers a few new (harmless) warnings for me:
> In file included from /home/andres/src/postgresql/src/include/postgres.h:46,
>                  from 
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:44:
> /home/andres/src/postgresql/src/backend/access/index/indexam.c: In function 
> ‘index_getprocid’:
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:782:17: 
> warning: comparison is always true due to limited range of data type 
> [-Wtype-limits]
>   782 |  Assert(procnum >= 0 && procnum <= (uint16) nproc);
>       |                 ^~
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:782:2: note: 
> in expansion of macro ‘Assert’
>   782 |  Assert(procnum >= 0 && procnum <= (uint16) nproc);
>       |  ^~~~~~
> /home/andres/src/postgresql/src/backend/access/index/indexam.c: In function 
> ‘index_getprocinfo’:
> /home/andres/src/postgresql/src/backend/access/index/indexam.c:818:17: 
> warning: comparison is always true due to limited range of data type 
> [-Wtype-limits]
>   818 |  Assert(procnum >= 0 && procnum <= (uint16) nproc);
>       |                 ^~
> /home/andres/src/postgresql/src/include/c.h:782:9: note: in definition of 
> macro ‘Assert’
>   782 |   if (!(condition)) \
>       |         ^~~~~~~~~
> PostgreSQL installation complete.

Thank you!  This reveals to me that this commit contains rudiments of
allowing procnum == 0.  I'll commit the fix soon.

BTW, what version of compiler (and options) do you use?  At the first
glance gcc and clang don't show these warnings to me.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


Reply via email to