Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64
Date: 2011-04-28 20:05:38
Message-ID: 2846.1304021138@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Dave Page <dpage(at)postgresql(dot)org> writes:
> On Thu, Apr 28, 2011 at 8:44 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Dave Page 2011-04-28 20:11:21 Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64
Previous Message Alvaro Herrera 2011-04-28 20:05:19 Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2011-04-28 20:11:21 Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64
Previous Message Alvaro Herrera 2011-04-28 20:05:19 Re: pgsql: Fix pg_size_pretty() to avoid overflow for inputs close to INT64