SunOS patch for memcmp()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: SunOS patch for memcmp()
Date: 2001-12-17 05:30:59
Message-ID: 200112170530.fBH5Uxq06554@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> > SunOS Tatsuo Ishii
> > Are we giving up on this one? Still relevant?
>
> What should we do? The only remaining issue is a non-8-bit-clean
> memcmp, which seems pretty easy to fix it.

OK, here is a patch to allow SunOS to pass the regression tests. One
attachment is the patch, which is quite small except that the line
numbers in configure changed with autoconf, and that bloated the patch.
The second attachment is the file memcmp.c which should be placed in
src/utils. I got this from NetBSD.

I tested the patch several ways. First I tested the regression tests
without the new memcmp(). Then I enabled the memcmp(). Thirdly, I had
the memcmp() always return '1' on non-equals rather than +/- 1, and saw
the same failures Tatuso saw.

One interesting item is that I had to compile with
backend/utils/adt/varbit.c with -fno-builtin because my gcc 2.X manual
says:

-fno-builtin
Don't recognize built-in functions that do not be-
gin with two leading underscores. Currently, the
functions affected include _exit, abort, abs, allo-
ca, cos, exit, fabs, labs, memcmp, memcpy, sin,
sqrt, strcmp, strcpy, and strlen.

So if you don't give that flag on BSD/OS, the memcmp() is inlined and
never called. Nice feature. Tatsuo, is there a newer compiler for
SunOS that will do this and bypass the broken libc memcmp() on that
platform?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(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

Attachment Content-Type Size
unknown_filename text/plain 77.5 KB
unknown_filename text/plain 862 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-12-17 06:46:37 7.2 is slow?
Previous Message Doug McNaught 2001-12-17 05:06:22 Re: Explicit config patch 7.2B4

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-12-17 07:43:48 Re: SunOS patch for memcmp()
Previous Message Peter Eisentraut 2001-12-16 22:23:56 Re: [PATCHES] system catalog relation of a table and a