From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22088 invoked by alias); 9 Jul 2005 11:37:50 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 22051 invoked by uid 22791); 9 Jul 2005 11:37:40 -0000 Received: from daedalus.desk.pl (HELO daedalus.desk.pl) (62.233.238.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 09 Jul 2005 11:37:40 +0000 Received: from localhost (localhost [127.0.0.1]) by daedalus.desk.pl (Postfix) with ESMTP id 1F0D136666C for ; Sat, 9 Jul 2005 13:29:20 +0200 (CEST) Received: from daedalus.desk.pl ([127.0.0.1]) by localhost (daedalus [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20274-02 for ; Sat, 9 Jul 2005 13:29:18 +0200 (CEST) Received: by daedalus.desk.pl (Postfix, from userid 1023) id A5F2A36663F; Sat, 9 Jul 2005 13:29:18 +0200 (CEST) Date: Sat, 09 Jul 2005 11:37:00 -0000 From: Marcin Koziej To: gcc-help@gcc.gnu.org Subject: gcc 4.1 on FreeBSD 5.4 Objective-c @finally abort()'s. Message-ID: <20050709112918.GA19196@daedalus.desk.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Antivirus: Skaner Antywirusowy DESK.pl X-SW-Source: 2005-07/txt/msg00098.txt.bz2 Hello! I'm trying to use @finally clause with gcc 4.1 (compiled from port lang/gcc41) on FreeBSD 5.4, but it crashes with abort(). I don't have a linux box availible to test if this is freebsd's case, my error or gcc's. I tried to debug it but run into gcc's exception handling internals (gcc/unwind.inc) which leave me without any ideas. A simple program: creep@carnivore[~p/paparazzi]:'< cat nt3.m #import @interface Exception : Object - print; @end @implementation Exception - print { printf("I'm an exception!\n"); return self; } @end void a(); int main(int ac, char *av[]) { @try { a(); } @catch (id pe) { printf("in main\n"); [[pe print] free]; } printf("end\n"); } void a() { printf("Beeble bah!\n"); @try { @throw [Exception new]; } @finally { printf("FINALLY\n"); } printf("Not reached\n"); return; } Running it: creep@carnivore[~]:> gcc41 -v Using built-in specs. Target: i386-portbld-freebsd5.4 Configured with: ./..//gcc-4.1-20050702/configure --disable-rpath --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=41 --libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0 --with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/include/c++/ --disable-shared --disable-libgcj --prefix=/usr/local i386-portbld-freebsd5.4 Thread model: posix gcc version 4.1.0 20050702 (experimental) creep@carnivore[~p/paparazzi]:> gcc41 -fobjc-exceptions nt3.m -I /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/include/ -lobjc creep@carnivore[~p/paparazzi]:> creep@carnivore[~p/paparazzi]:> ./a.out Beeble bah! FINALLY zsh: abort (core dumped) ./a.out creep@carnivore[~p/paparazzi]:'< gdb -core a.out.core a.out GNU gdb 6.1.1 [FreeBSD] 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-marcel-freebsd"... Core was generated by `a.out'. Program terminated with signal 6, Aborted. Reading symbols from /lib/libc.so.5...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /usr/libexec/ld-elf.so.1...done. Loaded symbols for /usr/libexec/ld-elf.so.1 #0 0x280d964f in kill () from /lib/libc.so.5 (gdb) bt #0 0x280d964f in kill () from /lib/libc.so.5 #1 0x280cd286 in raise () from /lib/libc.so.5 #2 0x2814e972 in abort () from /lib/libc.so.5 #3 0x0805455b in _Unwind_Resume (exc=0x805d760) at unwind.inc:237 #4 0x0804903b in a () #5 0x08048f4a in main () (gdb) I've done some debugging and it seems gcc/unwind.inc:_Unwind_Resume does abort 237 gcc_assert (code == _URC_INSTALL_CONTEXT); due to code == _URC_FATAL_PHASE2_ERROR returned by gcc/unwind.inc:_Unwind_RiseException_Phase2, which returns it because of 54 /* Identify when we've reached the designated handler context. */ 55 match_handler = (uw_identify_context (context) == exc->private_2 56 ? _UA_HANDLER_FRAME : 0); 57 58 if (code != _URC_NO_REASON) 59 /* Some error encountered. Usually the unwinder doesn't 60 diagnose these and merely crashes. */ 61 return _URC_FATAL_PHASE2_ERROR; here code being _URC_END_OF_STACK (instead of _URC_NO_REASON) Here I get puzzled, because it seems unwinding misses the @catch in main(). Any hints? Should I post a bug? (i tried to run gcc/testsuite/objc.dg/try-catch-1.m, after adding main() to it, with the same crash.) m.