Skip site navigation (1) Skip section navigation (2)

Re: snprintf causes regression tests to fail

From: Nicolai Tufar <ntufar(at)gmail(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>,pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: snprintf causes regression tests to fail
Date: 2005-02-28 19:42:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32pgsql-patches
After some extensive debugging with Magnus's
help we finally managed to a kind of isolate the 
problem. We placed snprintf.c in a separate
file, added necessary #includes and wrote
a simple main() function:

        unsigned long long ull=4567890123456789ULL;
        static char buf[1024];

When compiled with -D HAVE_LONG_LONG_INT_64=1
which declares long_long and ulong_long like:

    typedef long long long_long;
    typedef unsigned long long ulong_long;

It compiles fine and produces desired result. If not,
it produces "-869367531" as in regression tests.

Amazingly enough HAVE_LONG_LONG_INT_64 is
defined when compilation comes to src/port/snprintf.c
but the result is still wrong. I looked into
but the check for HAVE_LONG_LONG_INT_64 is too
complicated for me to understand. Bruce, could you
take a look at this? I am 90% sure it is an issue with
some configure definitions.

Best regards,

On Mon, 28 Feb 2005 19:58:15 +0200, Nicolai Tufar <ntufar(at)gmail(dot)com> wrote:
> Regression test diff is attached.
> It fails on the following tests:
>    int8
>    subselect
>    union
>    sequence
> It fails to display correctly number "4567890123456789".
> In output is shows "-869367531". Apparent overflow or
> interpreting int8 as int4.
> while rewriting snprintf() I did not touch the actual functions
> that convert number to ASCII digit string. In truth, if you
> force PostgreSQL to use snprintf.c without my patch applied
> it produces the same errors.
> What can be wrong? GCC bug? The one I use is:
> gcc.exe (GCC) 3.3.1 (mingw special 20030804-1)
> Any thoughts?
> On Mon, 28 Feb 2005 09:17:20 -0500 (EST), Bruce Momjian
> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> > Nicolai Tufar wrote:
> > > Linux and Solaris 10 x86 pass regression tests fine when I force the use of new
> > > snprintf().   The problem should be win32 - specific. I will
> > > investigate it throughly
> > > tonight. Can someone experienced in win32 what can possibly be the problem?
> >
> > Yea, I am confused too because my BSD uses the new snprintf.c code was
> > well.  Magnus, what failures are you seeing on Win32?
> >
> > --
> >   Bruce Momjian                        |
> >   pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
> >   +  If your life is a hard drive,     |  13 Roberts Road
> >   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
> >

In response to


pgsql-hackers by date

Next:From: Victor Y. YegorovDate: 2005-02-28 19:49:48
Subject: bitmap AM design
Previous:From: David FetterDate: 2005-02-28 18:44:33
Subject: Re: SQL99 Hierarchical queries

pgsql-patches by date

Next:From: Tom LaneDate: 2005-02-28 19:51:46
Subject: Re: snprintf causes regression tests to fail
Previous:From: Tom LaneDate: 2005-02-28 19:37:19
Subject: Re: int4 <-> bool casts

pgsql-hackers-win32 by date

Next:From: Tom LaneDate: 2005-02-28 19:51:46
Subject: Re: snprintf causes regression tests to fail
Previous:From: pgsqlDate: 2005-02-28 17:54:44
Subject: Re: snprintf causes regression tests to fail

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group