Re: integer overflow in reloption.h - Mailing list pgsql-hackers

From Tom Lane
Subject Re: integer overflow in reloption.h
Date
Msg-id 12827.1243203803@sss.pgh.pa.us
Whole thread Raw
In response to integer overflow in reloption.h  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
List pgsql-hackers
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> The problem is on the following lines

> typedef enum relopt_kind
> {
> ...
>         RELOPT_KIND_MAX = (1 << 31)
> }

> enum is int datatype and 1 << 31 == -2147483648. It is reason why
> compiler (sun studio) complains.

> Is possible to change it to 1 << 30 to stop compiler generates noise?

Yeah, but we also have to fix the code that uses it.  Done.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Gevik Babakhani
Date:
Subject: Re: pg_class and enum types
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)