Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id D4CDB2AB7EA for ; Fri, 17 Feb 2012 01:25:58 -0400 (AST) Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RyGKT-0008NT-RB for pgsql-bugs@postgresql.org; Fri, 17 Feb 2012 05:25:58 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RyGKF-0005Lp-Ki for pgsql-bugs@postgresql.org; Fri, 17 Feb 2012 05:25:45 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1RyGKF-0007i4-6P for pgsql-bugs@postgresql.org; Fri, 17 Feb 2012 05:25:43 +0000 Date: Fri, 17 Feb 2012 05:25:43 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6460: routine my_log2 use incorrect data type ? To: pgsql-bugs@postgresql.org From: zoulx1982@163.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/122 X-Sequence-Number: 32465 The following bug has been logged on the website: Bug reference: 6460 Logged by: lxzou Email address: zoulx1982@163.com PostgreSQL version: 9.1.2 Operating system: Windows Server 2008 64 bit Description: = Hi, I startup postgres in win server 2008 64-bit with shared_buffers=3D1073741819, but find it doesn't work. I debug the postgres use vs2008, and find it enter an Infinite loop in my_log2. when the parameter num is between (2^30) + 1 and (2^31) -1, it will be an Infinite loop. because long in win 64 is 4 bytes, so (2^30) << 1 is 2^31, i.e. -2^31. move left again it will be zero. size_t in win64 is 8 bytes=EF=BC=8Cso add_size and mul_size can't check ove= rflow, but in win32 it can do that. So, whether we should use Size instead of long ? Best wishes