Re: [HACKERS] "24" < INT_MIN returns TRUE ???

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <jwieck(at)debis(dot)com>
Cc: PostgreSQL HACKERS <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] "24" < INT_MIN returns TRUE ???
Date: 1999-07-09 04:01:27
Message-ID: 199907090401.AAA07699@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi,
>
> did anyone compile latest CVS with v1.31
> utils/adt/numutils.c?
>
> Marc activated some range checks in pg_atoi() and now I have
> a very interesting behaviour on a Linux box running gcc 2.8.1
> glibc-2.
>
> Inside of pg_atoi(), the value is read into a long. Comparing
> a small positive long like 24 against INT_MIN returns TRUE -
> dunno how. Putting INT_MIN into another long variable and
> comparing the two returns the expected FALSE - so what's
> going on here? long, int32 and int have all 4 bytes here.

I just reversed out the patch. It was causing initdb to fail!

I don't understand why it fails either, but have sent the report back to
the patch author.

I would love to hear the answer on this one.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-07-09 04:33:10 Re: [HACKERS] Arbitrary tuple size
Previous Message Bruce Momjian 1999-07-09 03:59:27 Re: [SQL] Index on Type Numeric