On Tue, Mar 23, 2010 at 11:34 AM, Lefteris
It works on my machine. Can you run it with gdb and send us the trace?
I guess it's something about threads. $ gcc -g bad.c && ./a.out Segmentation fault (core dumped) $ gdb a.out a.out.core GNU gdb 6.3 Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-openbsd4.6"... Core was generated by `a.out'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/lib/libc.so.51.0...done. Loaded symbols for /usr/lib/libc.so.51.0 Reading symbols from /usr/libexec/ld.so...done. Loaded symbols for /usr/libexec/ld.so #0 0x0f77ff14 in ?? () (gdb) where #0 0x0f77ff14 in ?? () #1 0x0adce36b in _dl_thread_kern_go () from /usr/libexec/ld.so #2 0x0adcde4b in dlclose () from /usr/libexec/ld.so #3 0x1c0007c5 in main () at bad.c:10 (gdb) quit $ head -10 bad.c | tail -1 dlclose(handle); $ grep -A 4 ^_dl_thread_kern_go /usr/src/libexec/ld.so/dlfcn.c _dl_thread_kern_go(void) { if (_dl_thread_fnc != NULL) (*_dl_thread_fnc)(1); } $