Opened 12 years ago

Closed 11 years ago

#31717 closed defect (fixed)

postgresql91 segfaults on OS X 10.7 when built with clang

Reported by: francis@… Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: haspatch Cc: mww@…, jyrkiwahlstedt, kevin@…, howarth@…, jmehnle (Julian Mehnle), drkp (Dan Ports), Kona8lend@…, anddam (Andrea D'Amore), jeremyhu (Jeremy Huddleston Sequoia), jason@…, icemac (Michael Howitz), nonstop.server@…
Port: postgresql91

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Steps to reproduce:

  1. On OS X 10.7.1 or 10.7.2 install Xcode 4.2
  2. port install postgresql91-server and follow the instructions that it prints to initdb
  3. createdb francis ('francis' is my username)
  4. psql91
  5. at the psql prompt, enter "\dt" (describe tables). psql91 segfaults at this point

How to fix:

Build with apple-gcc-4.2 (not LLVM/clang, which is the system default compiler in Xcode 4.2).

Attachments (4)

postgresql91-apple-gcc-4.2.diff (543 bytes) - added by francis@… 12 years ago.
Proposed fix
psql_2011-10-22-133757_murr.crash (7.8 KB) - added by francis@… 12 years ago.
Crash log
postgresql91-llvm-gcc-4.2.diff (575 bytes) - added by francis@… 12 years ago.
Updated patch
postgresql90-llvm-gcc-4.2.diff (575 bytes) - added by francis@… 12 years ago.

Download all attachments as: .zip

Change History (34)

Changed 12 years ago by francis@…

Proposed fix

Changed 12 years ago by francis@…

Crash log

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jwa@… added; mww@… removed
Description: modified (diff)
Keywords: haspatch added
Owner: changed from macports-tickets@… to mww@…

The default compiler on Xcode 4.2 is clang. Please try llvm-gcc-4.2; if that works, we want to use that, not apple-gcc-4.2.

If really only apple-gcc-4.2 works, then more code is needed than what you added in the patch; see wiki:PortfileRecipes#compiler

What about the older postgresql ports? Are they affected too?

comment:2 in reply to:  1 Changed 12 years ago by francis@…

Replying to ryandesign@…:

The default compiler on Xcode 4.2 is clang. Please try llvm-gcc-4.2; if that works, we want to use that, not apple-gcc-4.2.

OK I'll try that and update the patch. I was a bit confused before - I thought that LLVM and Clang were the same thing.

If really only apple-gcc-4.2 works, then more code is needed than what you added in the patch; see wiki:PortfileRecipes#compiler

What about the older postgresql ports? Are they affected too?

Yes, postgresql90 is also affected (I haven't tested any others).

comment:3 Changed 12 years ago by Veence (Vincent)

Normally, PostgreSQL 91 works with gcc45. The crash must come from a clang miscompilation.

Changed 12 years ago by francis@…

Updated patch

Changed 12 years ago by francis@…

comment:4 Changed 12 years ago by francis@…

llvm-gcc-4.2 works so I've updated the patch to use it. I've also attached a patch for postgresql90.

comment:5 Changed 12 years ago by kevin@…

Cc: kevin@… added

Cc Me!

comment:6 Changed 12 years ago by francis@…

I think that the postgresql91-llvm-gcc-4.2.diff and postgresql90-llvm-gcc-4.2.diff patches address Ryan's points and should be OK to be committed - can anyone check them and commit them if they're OK?

I haven't tested earlier versions of PostgreSQL to see whether they also need similar patches. Please let me know if you'd like me to do so.

comment:7 in reply to:  1 ; Changed 12 years ago by howarth@…

Replying to ryandesign@…:

The default compiler on Xcode 4.2 is clang. Please try llvm-gcc-4.2; if that works, we want to use that, not apple-gcc-4.2.

If really only apple-gcc-4.2 works, then more code is needed than what you added in the patch; see wiki:PortfileRecipes#compiler

What about the older postgresql ports? Are they affected too?

Are you sure about that? Every machine which I have installed Xcode 4.2 on (for both Lion and SL) has the system compiler set to llvm-gcc (instead of clang)?

comment:8 in reply to:  7 Changed 12 years ago by francis@…

Replying to howarth@…:

Replying to ryandesign@…:

The default compiler on Xcode 4.2 is clang. Please try llvm-gcc-4.2; if that works, we want to use that, not apple-gcc-4.2.

If really only apple-gcc-4.2 works, then more code is needed than what you added in the patch; see wiki:PortfileRecipes#compiler

What about the older postgresql ports? Are they affected too?

Are you sure about that? Every machine which I have installed Xcode 4.2 on (for both Lion and SL) has the system compiler set to llvm-gcc (instead of clang)?

You're right - on my machine the default compiler is llvm too:

francis@jupiter ~ $ uname -a
Darwin jupiter.repton.int 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
francis@jupiter ~ $ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

francis@jupiter ~ $ cc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However, postgresql91 segfaults for me without postgresql91-llvm-gcc-4.2.diff and works fine with postgresql91-llvm-gcc-4.2.diff applied. Perhaps MacPorts defaults to clang even though the system default compiler is llvm-gcc? ProblemHotlist suggests that: If a port foo fails to build and you're using Xcode 4.2 or later, the default compiler is clang; try compiling with llvm-gcc-4.2 instead

Have you tried doing a "\dt" on a postgresql91 built on 10.7 with Xcode 4.2? Did it work for you with/without the patch?

comment:9 in reply to:  7 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: howarth@… added

Replying to howarth@…:

Replying to ryandesign@…:

The default compiler on Xcode 4.2 is clang. Please try llvm-gcc-4.2; if that works, we want to use that, not apple-gcc-4.2.

If really only apple-gcc-4.2 works, then more code is needed than what you added in the patch; see wiki:PortfileRecipes#compiler

What about the older postgresql ports? Are they affected too?

Are you sure about that? Every machine which I have installed Xcode 4.2 on (for both Lion and SL) has the system compiler set to llvm-gcc (instead of clang)?

Yes, I am sure about that. Perhaps I should have been more specific: In MacPorts, the default compiler on Xcode 4.2 is clang, and on Xcode 4.0 and 4.1 it is llvm-gcc-4.2. If you would like to discuss this decision, please do so on macports-dev, not here.

comment:10 Changed 12 years ago by howarth@…

Does the problematic postgresql91 on MacPorts exhibit any test suite failures? The postgresql91 package built with clang under Xcode 4.2 on fink doesn't show any test suite failures.

comment:11 Changed 12 years ago by jmehnle (Julian Mehnle)

Cc: julian@… added

Cc Me!

comment:12 Changed 12 years ago by jmehnle (Julian Mehnle)

Here, too, issuing any query in my MacPorts psql fails with SIGSEV/EXC_BAD_ACCESS.

I'm on OS X 10.7.2 and Xcode 4.2:

joule:~> uname -a
Darwin joule 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64

joule:~> xcodebuild -version
Xcode 4.2
Build version 4D199

These are my compiler versions:

joule:~> clang --version
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

joule:~> cc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is there a workaround that I can apply locally? I need a working, MacPorts-based psql on this new machine.

comment:13 Changed 12 years ago by howarth@…

It would be interesting to know if this problem also causes any testsuite failures. On fink, the following works under Xcode 4.2 on Lion...

fink -k rebuild postgreaql91 cd /sw/src/fink.build/postgresql91-9.1.0-32 sudo chown -R howarth postgresql-9.1.0 cd postgresql-9.1.0 make -k check

=======================

All 126 tests passed.

=======================

In case it helps, on fink 10.7 using clang, the configure results are...

+ ./configure --prefix=/sw/opt/postgresql-9.1 --docdir=/sw/share/doc/postgresql91 '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --with-libraries=/sw/lib --with-includes=/sw/include --with-perl --with-python --with-tcl --with-tclconfig=/sw/lib --enable-thread-safety --with-openssl --with-pam --with-bonjour --with-krb5 --with-gssapi --with-libxml --with-libxslt checking build system type... x86_64-apple-darwin11.2.0 checking host system type... x86_64-apple-darwin11.2.0 checking which template to use... darwin checking whether to build with 64-bit integer date/time support... yes checking whether NLS is wanted... no checking for default port number... 5432 checking for block size... 8kB checking for segment size... 1GB checking for WAL block size... 8kB checking for WAL segment size... 16MB checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether clang accepts -g... yes checking for clang option to accept ISO C89... none needed checking whether clang supports -Wdeclaration-after-statement... yes checking whether clang supports -Wendif-labels... yes checking whether clang supports -Wformat-security... yes checking whether clang supports -fno-strict-aliasing... yes checking whether clang supports -fwrapv... yes checking whether the C compiler still works... yes checking how to run the C preprocessor... clang -E checking allow thread-safe client libraries... yes checking whether to build with Tcl... yes checking whether to build Perl modules... yes checking whether to build Python modules... yes checking whether to build with GSSAPI support... yes checking whether to build with Kerberos 5 support... yes checking whether to build with PAM support... yes checking whether to build with LDAP support... no checking whether to build with Bonjour support... yes checking whether to build with OpenSSL support... yes checking whether to build with SELinux support... no checking for xml2-config... xml2-config checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... no checking for ranlib... ranlib checking for strip... strip checking whether it is possible to strip libraries... no checking for ar... ar checking for tar... /sw/bin/tar checking whether ln -s works... yes checking for gawk... gawk checking for a thread-safe mkdir -p... config/install-sh -c -d checking for bison... /sw/bin/bison configure: using bison (GNU Bison) 2.3 checking for flex... /usr/bin/flex configure: using flex 2.5.35 configure: using perl 5.12.3 checking for Perl archlibexp... /System/Library/Perl/5.12/darwin-thread-multi-2level checking for Perl privlibexp... /System/Library/Perl/5.12 checking for Perl useshrplib... true checking for flags to link embedded Perl... -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -ldl -lm -lutil -lc checking for python... /usr/bin/python checking for Python distutils module... yes checking Python configuration directory... /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config checking how to link an embedded Python application... -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -ldl -framework CoreFoundation checking whether Python is compiled with thread support... yes checking for main in -lm... yes checking for library containing setproctitle... no checking for library containing dlopen... none required checking for library containing socket... none required checking for library containing shl_load... no checking for library containing getopt_long... none required checking for library containing crypt... none required checking for library containing fdatasync... none required checking for library containing gethostbyname_r... no checking for library containing shmget... none required checking for library containing readline... -lreadline checking for inflate in -lz... yes checking for library containing gss_init_sec_context... -lgssapi_krb5 checking for library containing com_err... none required checking for library containing krb5_sendauth... none required checking for CRYPTO_new_ex_data in -lcrypto... yes checking for SSL_library_init in -lssl... yes checking for pam_start in -lpam... yes checking for xmlSaveToBuffer in -lxml2... yes checking for xsltCleanupGlobals in -lxslt... yes checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking crypt.h usability... no checking crypt.h presence... no checking for crypt.h... no checking dld.h usability... no checking dld.h presence... no checking for dld.h... no checking fp_class.h usability... no checking fp_class.h presence... no checking for fp_class.h... no checking getopt.h usability... yes checking getopt.h presence... yes checking for getopt.h... yes checking ieeefp.h usability... no checking ieeefp.h presence... no checking for ieeefp.h... no checking ifaddrs.h usability... yes checking ifaddrs.h presence... yes checking for ifaddrs.h... yes checking langinfo.h usability... yes checking langinfo.h presence... yes checking for langinfo.h... yes checking poll.h usability... yes checking poll.h presence... yes checking for poll.h... yes checking pwd.h usability... yes checking pwd.h presence... yes checking for pwd.h... yes checking sys/ioctl.h usability... yes checking sys/ioctl.h presence... yes checking for sys/ioctl.h... yes checking sys/ipc.h usability... yes checking sys/ipc.h presence... yes checking for sys/ipc.h... yes checking sys/poll.h usability... yes checking sys/poll.h presence... yes checking for sys/poll.h... yes checking sys/pstat.h usability... no checking sys/pstat.h presence... no checking for sys/pstat.h... no checking sys/resource.h usability... yes checking sys/resource.h presence... yes checking for sys/resource.h... yes checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking sys/sem.h usability... yes checking sys/sem.h presence... yes checking for sys/sem.h... yes checking sys/shm.h usability... yes checking sys/shm.h presence... yes checking for sys/shm.h... yes checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking sys/sockio.h usability... yes checking sys/sockio.h presence... yes checking for sys/sockio.h... yes checking sys/tas.h usability... no checking sys/tas.h presence... no checking for sys/tas.h... no checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking sys/ucred.h usability... yes checking sys/ucred.h presence... yes checking for sys/ucred.h... yes checking sys/un.h usability... yes checking sys/un.h presence... yes checking for sys/un.h... yes checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking ucred.h usability... no checking ucred.h presence... no checking for ucred.h... no checking utime.h usability... yes checking utime.h presence... yes checking for utime.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking wctype.h usability... yes checking wctype.h presence... yes checking for wctype.h... yes checking kernel/OS.h usability... no checking kernel/OS.h presence... no checking for kernel/OS.h... no checking kernel/image.h usability... no checking kernel/image.h presence... no checking for kernel/image.h... no checking SupportDefs.h usability... no checking SupportDefs.h presence... no checking for SupportDefs.h... no checking for net/if.h... yes checking netinet/in.h usability... yes checking netinet/in.h presence... yes checking for netinet/in.h... yes checking for netinet/tcp.h... yes checking readline/readline.h usability... yes checking readline/readline.h presence... yes checking for readline/readline.h... yes checking readline/history.h usability... yes checking readline/history.h presence... yes checking for readline/history.h... yes checking zlib.h usability... yes checking zlib.h presence... yes checking for zlib.h... yes checking gssapi/gssapi.h usability... yes checking gssapi/gssapi.h presence... yes checking for gssapi/gssapi.h... yes checking krb5.h usability... yes checking krb5.h presence... yes checking for krb5.h... yes checking openssl/ssl.h usability... yes checking openssl/ssl.h presence... yes checking for openssl/ssl.h... yes checking openssl/err.h usability... yes checking openssl/err.h presence... yes checking for openssl/err.h... yes checking for ERR_set_mark... yes checking security/pam_appl.h usability... yes checking security/pam_appl.h presence... yes checking for security/pam_appl.h... yes checking libxml/parser.h usability... yes checking libxml/parser.h presence... yes checking for libxml/parser.h... yes checking libxslt/xslt.h usability... yes checking libxslt/xslt.h presence... yes checking for libxslt/xslt.h... yes checking dns_sd.h usability... yes checking dns_sd.h presence... yes checking for dns_sd.h... yes checking whether byte ordering is bigendian... no checking for an ANSI C-conforming const... yes checking for inline... inline checking for quiet inline (no complaint if unreferenced)... yes checking for preprocessor stringizing operator... yes checking for signed types... yes checking for working volatile... yes checking for func... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for struct tm.tm_zone... yes checking for tzname... yes checking for union semun... yes checking for struct sockaddr_un... yes checking for struct sockaddr_storage... yes checking for struct sockaddr_storage.ss_family... yes checking for struct sockaddr_storage.ss_family... no checking for struct sockaddr_storage.ss_len... yes checking for struct sockaddr_storage.ss_len... no checking for struct sockaddr.sa_len... yes checking for struct addrinfo... yes checking for intptr_t... yes checking for uintptr_t... yes checking for long long int... yes checking for locale_t... yes (in xlocale.h) checking for struct cmsgcred... no checking for struct option... yes checking for z_streamp... yes checking for krb5_ticket.enc_part2... yes checking for krb5_error.text.data... yes checking for krb5_free_unparsed_name... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... no checking size of off_t... 8 checking for int timezone... yes checking types of arguments for accept()... int, int, struct sockaddr *, socklen_t * checking whether gettimeofday takes only one argument... no checking for cbrt... yes checking for dlopen... yes checking for fcvt... yes checking for fdatasync... yes checking for getifaddrs... yes checking for getpeerucred... no checking for getrlimit... yes checking for memmove... yes checking for poll... yes checking for pstat... no checking for readlink... yes checking for scandir... yes checking for setproctitle... no checking for setsid... yes checking for sigprocmask... yes checking for symlink... yes checking for sysconf... yes checking for towlower... yes checking for utime... yes checking for utimes... yes checking for waitpid... yes checking for wcstombs... yes checking for wcstombs_l... yes checking for fseeko... yes checking for _LARGEFILE_SOURCE value needed for large files... no checking for posix_fadvise... no checking whether posix_fadvise is declared... no checking whether fdatasync is declared... no checking whether strlcat is declared... yes checking whether strlcpy is declared... yes checking whether F_FULLFSYNC is declared... yes checking for struct sockaddr_in6... yes checking for PS_STRINGS... no checking for snprintf... yes checking for vsnprintf... yes checking whether snprintf is declared... yes checking whether vsnprintf is declared... yes checking for isinf... yes checking for crypt... yes checking for erand48... yes checking for getopt... yes checking for getrusage... yes checking for inet_aton... yes checking for random... yes checking for rint... yes checking for srandom... yes checking for strdup... yes checking for strerror... yes checking for strlcat... yes checking for strlcpy... yes checking for strtol... yes checking for strtoul... yes checking for unsetenv... yes checking for getpeereid... yes checking for getaddrinfo... yes checking for getopt_long... yes checking for rl_completion_append_character... yes checking for rl_completion_matches... yes checking for rl_filename_completion_function... yes checking for append_history... yes checking for history_truncate_file... yes checking for sigsetjmp... yes checking whether sys_siglist is declared... yes checking for syslog... yes checking syslog.h usability... yes checking syslog.h presence... yes checking for syslog.h... yes checking for opterr... yes checking for optreset... yes checking for strtoll... yes checking for strtoull... yes checking for atexit... yes checking for the pthreads library -lpthreads... no checking whether pthreads work without any flags... yes checking whether pthreads work with -Kthread... no checking whether pthreads work with -kthread... no checking for the pthreads library -llthread... no checking whether pthreads work with -pthread... yes checking whether pthreads work with -pthreads... no checking whether pthreads work with -mthreads... no checking for the pthreads library -lpthread... yes checking whether pthreads work with --thread-safe... no checking whether pthreads work with -mt... no checking for the pthreads library -lpthreadGC2... no checking pthread.h usability... yes checking pthread.h presence... yes checking for pthread.h... yes checking for strerror_r... yes checking for getpwuid_r... yes checking for gethostbyname_r... no checking whether getpwuid_r takes a fifth argument... yes checking whether strerror_r returns int... yes checking test program... ok checking whether long int is 64 bits... yes checking size of void *... 8 checking size of size_t... 8 checking size of long... 8 checking whether to build with float4 passed by value... yes checking whether to build with float8 passed by value... yes checking alignment of short... 2 checking alignment of int... 4 checking alignment of long... 8 checking alignment of double... 8 checking for int8... no checking for uint8... no checking for int64... no checking for uint64... no checking for sig_atomic_t... yes checking for POSIX signal interface... yes checking for working memcmp... yes checking for tclsh... /sw/bin/tclsh checking for tclConfig.sh... /sw/lib/tclConfig.sh checking tcl.h usability... yes checking tcl.h presence... yes checking for tcl.h... yes checking Python.h usability... yes checking Python.h presence... yes checking for Python.h... yes checking for onsgmls... onsgmls checking for openjade... openjade checking for DocBook V4.2... no checking for DocBook stylesheets... /sw/share/sgml/dsssl/docbook-dsssl-nwalsh checking for collateindex.pl... /sw/bin/collateindex.pl checking for xsltproc... xsltproc checking for osx... osx checking thread safety of required library functions... yes checking whether clang supports -Wl,-dead_strip_dylibs... yes configure: using CFLAGS=-O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv configure: using CPPFLAGS=-I/sw/lib/system-openssl/include -DHAVE_OPTRESET -fno-common -I/sw/include -I/sw/include/libxml2 -I/sw/include -I/sw/include configure: using LDFLAGS=-L/sw/lib/system-openssl/lib -F/System/Library/Frameworks -L/sw/lib -L/sw/lib -L/sw/lib -L/sw/lib -Wl,-dead_strip_dylibs

comment:14 Changed 12 years ago by drkp (Dan Ports)

Cc: dports@… added

Cc Me!

comment:15 Changed 12 years ago by drkp (Dan Ports)

I'm seeing this too (and have heard reports of a couple other people being affected). psql segfaults on any query when built with clang; llvm-gcc-4.2 works fine.

I don't know why it's failing under clang, and it would be nice to find that out, but we need to change the port (and probably the other postgresql ports?) to build with llvm-gcc for now -- it is currently unusable.

comment:16 Changed 12 years ago by Veence (Vincent)

The crash happens in the psql91 utility. libpq-fe, the C API for querying PostgreSQL, works fine (e.g. QGis works okay with a PostGIS 2.0SVN/PostGreSQL 9.1 config).

comment:17 Changed 12 years ago by Kona8lend@…

fyi, clang tot produces a psql binary which does not crash on query:

clang version 3.1 (trunk 144977)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

and to add yet another confirmation, a psql binary produced with Xcode 4.2 clang does crash on query:

Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

comment:18 Changed 12 years ago by Kona8lend@…

Cc: Kona8lend@… added

Cc Me!

comment:19 Changed 12 years ago by drkp (Dan Ports)

Summary: postgresql91 segfaults on OS X 10.7 when built with Xcode 4.2postgresql91 segfaults on OS X 10.7 when built with clang

I've forced llvm-gcc4.2 instead of clang in r87589. I'm keeping this open because we ought to take a closer look at why it's failing with clang; it seems like it might be something specific to the MacPorts port rather than Postgres itself.

I only changed the postgresql90 and postgresql91 ports; postgresql84 seemed to work OK with clang, and I didn't test any earlier versions.

comment:20 Changed 12 years ago by Kona8lend@…

Definitely a clang bug up to and including Xcode 4.2.1. Manifests as segfault in postgresql-9.1.1/src/bin/psql/common.c:579. Basically clang -O2 erroneously replaces the memcpy() with movaps instructions which require 16-byte alignment even when data is not aligned.

Fixed is in opensource llvm/clang trunk r140902. Not sure when it will roll to Xcode.

comment:21 Changed 12 years ago by anddam (Andrea D'Amore)

Cc: and.damore@… added

Cc Me!

comment:22 Changed 12 years ago by drkp (Dan Ports)

Cc: jeremyhu@… added
Resolution: fixed
Status: newclosed

Appears fixed in xcode 4.3 (see r91669)

comment:23 Changed 12 years ago by drkp (Dan Ports)

Cc: jason@… added
Resolution: fixed
Status: closedreopened

There's a report of this failing again with clang on Xcode 4.3 in #30090.

comment:24 in reply to:  22 Changed 12 years ago by drkp (Dan Ports)

Replying to dports@…:

Appears fixed in xcode 4.3 (see r91669)

For the record, that should be r91339.

comment:25 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Owner: changed from mww@… to jeremyhu@…
Status: reopenednew

Hrrm...

comment:26 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

r91853 r91854 for now... I wonder if there is more to this bug (or a regression)...

comment:27 Changed 12 years ago by icemac (Michael Howitz)

Cc: mh@… added

Cc Me!

comment:28 Changed 12 years ago by nonstop.server@…

Cc: nonstop.server@… added

Cc Me!

comment:29 Changed 12 years ago by jmroot (Joshua Root)

Cc: mww@… added

comment:30 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.