BUG #4397: crash in tab-complete.c

Started by Rudolf Leitgebover 17 years ago9 messagesbugs
Jump to latest
#1Rudolf Leitgeb
r.leitgeb@x-pin.com

The following bug has been logged online:

Bug reference: 4397
Logged by: Rudolf Leitgeb
Email address: r.leitgeb@x-pin.com
PostgreSQL version: 8.3.3
Operating system: OSX Leopard
Description: crash in tab-complete.c
Details:

When I compiled postgresql for different targets (i386, x86_64, ppc, ppc64)
on my Mac, tab-complete.c gave me a number of warnings, that integers are
converted to pointers. Sure enouugh, psql bombs as soon as I hit the TAB key
...

How to reproduce:

- Compile psql for x86_64. This can be easily done with the following
commands:

CFLAGS="-Os -arch x86_64" LDFLAGS="-arch x86_64" ./configure
--disable-depend --with-pam --with-openssl
--prefix=/Users/rleitgeb/pq_x86_64

make

make install

- Then connect to a database with psql and hit tab. gdb will output the
following:

postgres=#
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000809000
0x00000001001fa1dc in fn_complete ()
(gdb) bt
#0 0x00000001001fa1dc in fn_complete ()
#1 0x00000001001fbb26 in rl_complete ()
#2 0x00000001001fbb38 in rl_complete ()
#3 0x00000001001ef07b in el_gets ()
#4 0x00000001001fc0be in readline ()
#5 0x0000000100006aaa in gets_interactive ()
#6 0x000000010000725e in MainLoop ()
#7 0x000000010000a070 in main ()

In reply to: Rudolf Leitgeb (#1)
Re: BUG #4397: crash in tab-complete.c

Rudolf Leitgeb escreveu:

- Compile psql for x86_64. This can be easily done with the following
commands:

CFLAGS="-Os -arch x86_64" LDFLAGS="-arch x86_64" ./configure
--disable-depend --with-pam --with-openssl
--prefix=/Users/rleitgeb/pq_x86_64

Are you using libedit, right? What is the exact version? Looking at the
backtrace, it seems to be a libedit problem. Try to update your version
or use readline instead.

--
Euler Taveira de Oliveira
http://www.timbira.com/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rudolf Leitgeb (#1)
Re: BUG #4397: crash in tab-complete.c

"Rudolf Leitgeb" <r.leitgeb@x-pin.com> writes:

- Compile psql for x86_64. This can be easily done with the following
commands:

CFLAGS="-Os -arch x86_64" LDFLAGS="-arch x86_64" ./configure
--disable-depend --with-pam --with-openssl
--prefix=/Users/rleitgeb/pq_x86_64

I don't think it's really as "easy" as all that with the 8.3 source tree.
This might possibly work with CVS HEAD due to recent changes in our
build process, but I'll bet that you simply aren't getting fully 64-bit
executables this way in 8.3.

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#3)
Re: BUG #4397: crash in tab-complete.c

I wrote:

"Rudolf Leitgeb" <r.leitgeb@x-pin.com> writes:

- Compile psql for x86_64. This can be easily done with the following
commands:

CFLAGS="-Os -arch x86_64" LDFLAGS="-arch x86_64" ./configure
--disable-depend --with-pam --with-openssl
--prefix=/Users/rleitgeb/pq_x86_64

I don't think it's really as "easy" as all that with the 8.3 source tree.

No, I take that back. On my machine (OSX 10.5.4, Xcode 3.1) the above
recipe does produce working 64-bit executables, in both HEAD and 8.3.
I see no crash as described, and there are no unexpected compile warnings
either. So I now concur with Euler's theory that there's something
broken about your copy of libedit. (One possibility is that you're not
using Apple's libedit, but a locally installed copy of libreadline that
isn't 64-bit ...)

regards, tom lane

#5Rudolf Leitgeb
r.leitgeb@x-pin.com
In reply to: Euler Taveira de Oliveira (#2)
Re: BUG #4397: crash in tab-complete.c

Yes, libedit is used. On Mac OSX libreadline is a soft link
to libedit, so that's what's used regardless of configure settings.

Here are the version numbers:

$ ll /usr/lib/libreadline.dylib
lrwxr-xr-x 1 root wheel 15 2 Apr 18:51 /usr/lib/libreadline.dylib -

libedit.2.dylib

$ ll /usr/lib/libedit.2.dylib
-rwxr-xr-x 1 root wheel 578704 24 Sep 2007 /usr/lib/libedit.2.dylib

$ otool -D /usr/lib/libedit.2.dylib
/usr/lib/libedit.2.dylib:
/usr/lib/libedit.2.dylib

$ otool -L /usr/lib/libedit.2.dylib
/usr/lib/libedit.2.dylib:
/usr/lib/libedit.2.dylib (compatibility version 2.0.0, current
version 2.9.0)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current
version 5.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.0.0)

$ file /usr/lib/libedit.2.dylib
/usr/lib/libedit.2.dylib: Mach-O universal binary with 4 architectures
/usr/lib/libedit.2.dylib (for architecture ppc7400): Mach-O
dynamically linked shared library ppc
/usr/lib/libedit.2.dylib (for architecture ppc64): Mach-O 64-bit
dynamically linked shared library ppc64
/usr/lib/libedit.2.dylib (for architecture i386): Mach-O dynamically
linked shared library i386
/usr/lib/libedit.2.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64

Am 03.09.2008 um 17:38 schrieb Euler Taveira de Oliveira:

Rudolf Leitgeb escreveu:

- Compile psql for x86_64. This can be easily done with the following
commands:

CFLAGS="-Os -arch x86_64" LDFLAGS="-arch x86_64" ./configure
--disable-depend --with-pam --with-openssl
--prefix=/Users/rleitgeb/pq_x86_64

Are you using libedit, right? What is the exact version? Looking at
the
backtrace, it seems to be a libedit problem. Try to update your
version
or use readline instead.

--
Euler Taveira de Oliveira
http://www.timbira.com/

--

DI. Dr. Rudolf Leitgeb
Chief Technological Officer
x-pin.com GmbH
Linke Wienzeile 4, Stiege 2, Tür 5
A-1060 Vienna/Austria/Europe
FN 255.127m, UID: ATU61232222
[mobile] +43-664-583-2419
[telefax] +43-1-587-70-84
[e-mail] r.leitgeb@x-pin.com

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rudolf Leitgeb (#5)
Re: BUG #4397: crash in tab-complete.c

Rudolf Leitgeb <r.leitgeb@x-pin.com> writes:

Yes, libedit is used. On Mac OSX libreadline is a soft link
to libedit, so that's what's used regardless of configure settings.

Actually, given that you got compile warnings, the thing to focus on is
probably what readline #include files were used. I'm still suspicious
of a local readline installation messing things up --- is there anything
in /usr/local/include?

What were those warnings, anyway?

regards, tom lane

#7Rudolf Leitgeb
r.leitgeb@x-pin.com
In reply to: Tom Lane (#6)
Re: BUG #4397: crash in tab-complete.c

Sorry for the delay, here are the compile warnings
I got when I compiled tab-complete.c for x86_64:

=========================================================
tab-complete.c: In function ‘psql_completion’:
tab-complete.c:601: warning: implicit declaration of function
‘completion_matches’
tab-complete.c:601: warning: assignment makes pointer from integer
without a cast
tab-complete.c:605: warning: assignment makes pointer from integer
without a cast
tab-complete.c:610: warning: assignment makes pointer from integer
without a cast
tab-complete.c:618: warning: assignment makes pointer from integer
without a cast
tab-complete.c:634: warning: assignment makes pointer from integer
without a cast
tab-complete.c:644: warning: assignment makes pointer from integer
without a cast
tab-complete.c:655: warning: assignment makes pointer from integer
without a cast
tab-complete.c:665: warning: assignment makes pointer from integer
without a cast
tab-complete.c:675: warning: assignment makes pointer from integer
without a cast
tab-complete.c:685: warning: assignment makes pointer from integer
without a cast
tab-complete.c:699: warning: assignment makes pointer from integer
without a cast
tab-complete.c:707: warning: assignment makes pointer from integer
without a cast
tab-complete.c:716: warning: assignment makes pointer from integer
without a cast
tab-complete.c:726: warning: assignment makes pointer from integer
without a cast
tab-complete.c:736: warning: assignment makes pointer from integer
without a cast
tab-complete.c:746: warning: assignment makes pointer from integer
without a cast
tab-complete.c:756: warning: assignment makes pointer from integer
without a cast
tab-complete.c:764: warning: assignment makes pointer from integer
without a cast
tab-complete.c:769: warning: assignment makes pointer from integer
without a cast
tab-complete.c:775: warning: assignment makes pointer from integer
without a cast
tab-complete.c:784: warning: assignment makes pointer from integer
without a cast
tab-complete.c:789: warning: assignment makes pointer from integer
without a cast
tab-complete.c:802: warning: assignment makes pointer from integer
without a cast
tab-complete.c:812: warning: assignment makes pointer from integer
without a cast
tab-complete.c:822: warning: assignment makes pointer from integer
without a cast
tab-complete.c:831: warning: assignment makes pointer from integer
without a cast
tab-complete.c:838: warning: assignment makes pointer from integer
without a cast
tab-complete.c:848: warning: assignment makes pointer from integer
without a cast
tab-complete.c:854: warning: assignment makes pointer from integer
without a cast
tab-complete.c:861: warning: assignment makes pointer from integer
without a cast
tab-complete.c:870: warning: assignment makes pointer from integer
without a cast
tab-complete.c:876: warning: assignment makes pointer from integer
without a cast
tab-complete.c:888: warning: assignment makes pointer from integer
without a cast
tab-complete.c:891: warning: assignment makes pointer from integer
without a cast
tab-complete.c:896: warning: assignment makes pointer from integer
without a cast
tab-complete.c:905: warning: assignment makes pointer from integer
without a cast
tab-complete.c:911: warning: assignment makes pointer from integer
without a cast
tab-complete.c:920: warning: assignment makes pointer from integer
without a cast
tab-complete.c:929: warning: assignment makes pointer from integer
without a cast
tab-complete.c:939: warning: assignment makes pointer from integer
without a cast
tab-complete.c:946: warning: assignment makes pointer from integer
without a cast
tab-complete.c:956: warning: assignment makes pointer from integer
without a cast
tab-complete.c:967: warning: assignment makes pointer from integer
without a cast
tab-complete.c:977: warning: assignment makes pointer from integer
without a cast
tab-complete.c:986: warning: assignment makes pointer from integer
without a cast
tab-complete.c:993: warning: assignment makes pointer from integer
without a cast
tab-complete.c:999: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1009: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1017: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1021: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1028: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1037: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1042: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1052: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1057: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1067: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1077: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1084: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1096: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1105: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1113: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1125: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1136: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1147: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1153: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1159: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1164: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1168: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1178: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1180: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1185: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1189: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1196: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1203: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1208: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1217: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1224: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1229: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1240: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1250: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1257: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1268: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1273: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1283: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1294: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1308: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1320: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1331: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1338: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1343: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1351: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1359: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1374: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1378: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1386: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1396: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1403: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1437: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1442: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1450: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1461: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1467: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1471: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1480: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1493: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1501: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1512: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1523: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1532: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1546: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1559: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1564: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1580: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1593: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1595: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1597: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1599: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1601: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1603: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1605: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1614: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1619: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1624: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1628: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1633: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1645: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1655: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1661: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1666: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1670: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1679: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1694: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1699: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1704: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1709: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1713: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1722: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1727: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1730: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1734: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1738: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1743: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1751: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1756: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1758: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1761: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1772: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1774: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1792: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1802: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1815: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1826: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1833: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1845: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1854: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1859: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1867: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1873: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1877: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1883: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1896: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1903: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1910: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1916: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1920: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1924: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1929: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1932: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1940: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1945: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1952: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1960: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1967: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1973: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1977: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1981: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1987: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1992: warning: assignment makes pointer from integer
without a cast
tab-complete.c:1997: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2004: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2010: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2012: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2014: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2016: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2018: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2020: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2022: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2024: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2026: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2028: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2030: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2032: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2034: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2036: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2038: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2040: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2042: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2044: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2046: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2048: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2050: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2052: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2060: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2070: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2087: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2089: warning: assignment makes pointer from integer
without a cast
tab-complete.c:2103: warning: assignment makes pointer from integer
without a cast
=========================================================

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rudolf Leitgeb (#7)
Re: BUG #4397: crash in tab-complete.c

Rudolf Leitgeb <r.leitgeb@x-pin.com> writes:

Sorry for the delay, here are the compile warnings
I got when I compiled tab-complete.c for x86_64:

=========================================================
tab-complete.c: In function ‘psql_completion’:
tab-complete.c:601: warning: implicit declaration of function
‘completion_matches’
tab-complete.c:601: warning: assignment makes pointer from integer
without a cast

Well, that nicely explains a crash in a 64-bit build, so the question
is what happened to your declaration of completion_matches(). It's
certainly there on my Mac:

tgl$ grep completion_matches /usr/include/readline/readline.h
char **completion_matches(const char *, CPFunction *);
$

I'm still suspicious that you've got something bogus under
/usr/local/include that is masking the correct include file.

regards, tom lane

#9Rudolf Leitgeb
r.leitgeb@x-pin.com
In reply to: Tom Lane (#8)
Re: BUG #4397: crash in tab-complete.c

Problem solved!

The was a left over readline.h which caused the miscompile process :(
Thanks a lot for all your help !

Cheers,

Rudi

Am 08.09.2008 um 15:03 schrieb Tom Lane:

Show quoted text

Rudolf Leitgeb <r.leitgeb@x-pin.com> writes:

Sorry for the delay, here are the compile warnings
I got when I compiled tab-complete.c for x86_64:

=========================================================
tab-complete.c: In function ‘psql_completion’:
tab-complete.c:601: warning: implicit declaration of function
‘completion_matches’
tab-complete.c:601: warning: assignment makes pointer from integer
without a cast

Well, that nicely explains a crash in a 64-bit build, so the question
is what happened to your declaration of completion_matches(). It's
certainly there on my Mac:

tgl$ grep completion_matches /usr/include/readline/readline.h
char **completion_matches(const char *, CPFunction *);
$

I'm still suspicious that you've got something bogus under
/usr/local/include that is masking the correct include file.

regards, tom lane