Hi,
For a while I've been getting warnings like
/home/andres/src/postgresql/src/backend/utils/adt/inet_cidr_ntop.c: In function
‘inet_cidr_ntop_ipv6’:
/home/andres/src/postgresql/src/backend/utils/adt/inet_cidr_ntop.c:205:11:
warning: left shift of negative value [-Wshift-negative-value]
m = ~0 << (8 - b);
^~
/home/andres/src/postgresql/src/backend/utils/adt/network.c: In function
‘inetmi’:
/home/andres/src/postgresql/src/backend/utils/adt/network.c:1482:24: warning:
left shift of negative value [-Wshift-negative-value]
res |= ((int64) -1) << (byte * 8);
^~
/home/andres/src/postgresql/src/backend/utils/adt/varbit.c: In function
‘bitfromint4’:
/home/andres/src/postgresql/src/backend/utils/adt/varbit.c:1546:16: warning:
left shift of negative value [-Wshift-negative-value]
val |= (-1) << (srcbitsleft + 8 - destbitsleft);
^~
/home/andres/src/postgresql/src/backend/utils/adt/varbit.c: In function
‘bitfromint8’:
/home/andres/src/postgresql/src/backend/utils/adt/varbit.c:1626:16: warning:
left shift of negative value [-Wshift-negative-value]
val |= (-1) << (srcbitsleft + 8 - destbitsleft);
If I understand C99 correctly, the behaviour of a left-shift of a
negative number is undefined (6.5.7 4.). In C89 the spec was very
unclear about that.
Greetings,
Andres Freund
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers