Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64 - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64
Date
Msg-id 2846.1304021138@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64  (Dave Page <dpage@postgresql.org>)
List pgsql-committers
Dave Page <dpage@postgresql.org> writes:
> On Thu, Apr 28, 2011 at 8:44 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I was suspicious that it had something to do with the compiler trying to
>> optimize the size / mult and size % mult subexpressions

> Already did (that was my first assumption). Removing them doesn't
> help, nor does rewriting them in various strange ways. Removing val++;
> (and replacing with { } ) allows compilation to succeed.

Huh.  Well, it might still be the case that switching to a shift-based
implementation would work around it, since we could avoid having any ++
operation in that.  Let me give it a shot.

            regards, tom lane

pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64
Next
From: Dave Page
Date:
Subject: Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64