gcc version 4.3.1 ada exception bug from foreign code?
Hello. I've hit a wall which I believe to be a bug in GCC 4.3.1. Essentially, a piece of Ada code calls a foreign C function with a callback as an argument. The callback is an Ada procedure which raises an exception. The original Ada caller catches the exception and execution continues from that point. That's what *should* happen (and does on the other platforms I've tested on). However, on lenny/sid with GCC 4.3.1, it seems that the exception never leaves the innermost callback, instead printing an error message to stderr as if an unhandled exception had reached the outermost point of the program: raised EXCEPT.TEST_ERROR : this should have been caught Here's a code example: /* cpart.c */ #include #include void (*raiser_callback)(const char *str) = NULL; void cpart_set (void (*callback)(const char *str)) { raiser_callback = callback; } void cpart_raise (const char *str) { printf ("-- C %s\n", __func__); raiser_callback (str); printf ("-- C %s - should not be here\n", __func__); abort (); /* not reached */ } -- except.adb with interfaces.c.strings; with ada.text_io; with ada.exceptions; procedure except is package io renames ada.text_io; package ex renames ada.exceptions; package cs renames interfaces.c.strings; test_error : exception; procedure ada_raiser (str : cs.chars_ptr) is begin io.put_line ("-- Ada ada_raiser"); raise test_error with cs.value (str); end ada_raiser; procedure cpart_raise (str : cs.chars_ptr); procedure cpart_set (callback : access procedure (str : cs.chars_ptr)); pragma import (c, cpart_raise, "cpart_raise"); pragma import (c, cpart_set, "cpart_set"); message : cs.chars_ptr := cs.new_string ("this should have been caught"); begin io.put_line ("-- Ada begin"); -- set callback for exception raising cpart_set (ada_raiser'access); begin cpart_raise (message); exception -- exception handling section here is not reached, process exits when e : test_error => io.put_line ("caught test_error: " & ex.exception_message (e)); end; -- execution never reaches this line io.put_line ("-- Ada end"); end except; Any help would be appreciated (even confirmation that this isn't my fault would be nice). -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: gcc version 4.3.1 ada exception bug from foreign code?
On Thu, Sep 11, 2008 at 03:34:53PM +0100, [EMAIL PROTECTED] wrote: > Essentially, a piece of Ada code calls a foreign C function with > a callback as an argument. The callback is an Ada procedure which > raises an exception. The original Ada caller catches the exception > and execution continues from that point. Do you build the C source with -fexceptions? Otherwise its illegal to throw exception through this code. Bastian -- You can't evaluate a man by logic alone. -- McCoy, "I, Mudd", stardate 4513.3 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: gcc version 4.3.1 ada exception bug from foreign code?
On 20080911 17:37:23, Bastian Blank wrote: > On Thu, Sep 11, 2008 at 03:34:53PM +0100, [EMAIL PROTECTED] wrote: > > Essentially, a piece of Ada code calls a foreign C function with > > a callback as an argument. The callback is an Ada procedure which > > raises an exception. The original Ada caller catches the exception > > and execution continues from that point. > > Do you build the C source with -fexceptions? Otherwise its illegal to > throw exception through this code. Well, that was painless. Thanks. I wasn't even aware of the -fexceptions flag. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Processing of ppl_0.10~pre27-2_i386.changes
ppl_0.10~pre27-2_i386.changes uploaded successfully to localhost along with the files: ppl_0.10~pre27-2.dsc ppl_0.10~pre27-2.diff.gz libppl7_0.10~pre27-2_i386.deb libppl-dev_0.10~pre27-2_i386.deb libppl-c0_0.10~pre27-2_i386.deb libpwl4_0.10~pre27-2_i386.deb libpwl-dev_0.10~pre27-2_i386.deb libppl-doc_0.10~pre27-2_all.deb Greetings, Your Debian queue daemon -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
ppl_0.10~pre27-2_i386.changes is NEW
libppl-c0_0.10~pre27-2_i386.deb to pool/main/p/ppl/libppl-c0_0.10~pre27-2_i386.deb libppl-dev_0.10~pre27-2_i386.deb to pool/main/p/ppl/libppl-dev_0.10~pre27-2_i386.deb libppl-doc_0.10~pre27-2_all.deb to pool/main/p/ppl/libppl-doc_0.10~pre27-2_all.deb (new) libppl7_0.10~pre27-2_i386.deb optional libs Parma Polyhedra Library (runtime library) The Parma Polyhedra Library (PPL) is a C++ library for the manipulation of (not necessarily closed) convex polyhedra and other numerical abstractions. The applications of convex polyhedra include program analysis, optimized compilation, integer and combinatorial optimization and statistical data-editing. The Parma Polyhedra Library is user friendly (you write `x + 2*y + 5*z <= 7' when you mean it), fully dynamic (available virtual memory is the only limitation to the dimension of anything), written in standard C++, exception-safe, rather efficient and thoroughly documented. (new) libpwl-dev_0.10~pre27-2_i386.deb optional libdevel Parma Watchdog Library (Watchdog timers - development) The Parma Watchdog Library (PWL) provides support for multiple, concurrent watchdog timers on systems providing setitimer(2). The PWL is currently distributed with the Parma Polyhedra Library (PPL), but is totally independent from it. (new) libpwl4_0.10~pre27-2_i386.deb optional libs Parma Watchdog Library (Watchdog timers - runtime library) The Parma Watchdog Library (PWL) provides support for multiple, concurrent watchdog timers on systems providing setitimer(2). The PWL is currently distributed with the Parma Polyhedra Library (PPL), but is totally independent from it. ppl_0.10~pre27-2.diff.gz to pool/main/p/ppl/ppl_0.10~pre27-2.diff.gz ppl_0.10~pre27-2.dsc to pool/main/p/ppl/ppl_0.10~pre27-2.dsc Changes: ppl (0.10~pre27-2) unstable; urgency=low . * debian/rules: set texmf save_size to 1 when building the docs * debian/control: libppl-dev Provides: libppl-c-dev * debian/control: Don't Recommends: graphviz, Suggests: libgmp3-doc, this is pointless Override entries for your package: libppl-c0_0.10~pre27-2_i386.deb - optional libs libppl-dev_0.10~pre27-2_i386.deb - optional libdevel libppl-doc_0.10~pre27-2_all.deb - optional doc ppl_0.10~pre27-2.dsc - source libs Announcing to [EMAIL PROTECTED] Your package contains new components which requires manual editing of the override file. It is ok otherwise, so please be patient. New packages are usually added to the override file about once a week. You may have gotten the distribution wrong. You'll get warnings above if files already exist in other distributions. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Processing of ppl_0.10~pre27-3_i386.changes
ppl_0.10~pre27-3_i386.changes uploaded successfully to localhost along with the files: ppl_0.10~pre27-3.dsc ppl_0.10~pre27-3.diff.gz libppl7_0.10~pre27-3_i386.deb libppl-dev_0.10~pre27-3_i386.deb libppl-c0_0.10~pre27-3_i386.deb libpwl4_0.10~pre27-3_i386.deb libpwl-dev_0.10~pre27-3_i386.deb libppl-doc_0.10~pre27-3_all.deb Greetings, Your Debian queue daemon -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
ppl_0.10~pre27-3_i386.changes is NEW
libppl-c0_0.10~pre27-3_i386.deb to pool/main/p/ppl/libppl-c0_0.10~pre27-3_i386.deb libppl-dev_0.10~pre27-3_i386.deb to pool/main/p/ppl/libppl-dev_0.10~pre27-3_i386.deb libppl-doc_0.10~pre27-3_all.deb to pool/main/p/ppl/libppl-doc_0.10~pre27-3_all.deb (new) libppl7_0.10~pre27-3_i386.deb optional libs Parma Polyhedra Library (runtime library) The Parma Polyhedra Library (PPL) is a C++ library for the manipulation of (not necessarily closed) convex polyhedra and other numerical abstractions. The applications of convex polyhedra include program analysis, optimized compilation, integer and combinatorial optimization and statistical data-editing. The Parma Polyhedra Library is user friendly (you write `x + 2*y + 5*z <= 7' when you mean it), fully dynamic (available virtual memory is the only limitation to the dimension of anything), written in standard C++, exception-safe, rather efficient and thoroughly documented. (new) libpwl-dev_0.10~pre27-3_i386.deb optional libdevel Parma Watchdog Library (Watchdog timers - development) The Parma Watchdog Library (PWL) provides support for multiple, concurrent watchdog timers on systems providing setitimer(2). The PWL is currently distributed with the Parma Polyhedra Library (PPL), but is totally independent from it. (new) libpwl4_0.10~pre27-3_i386.deb optional libs Parma Watchdog Library (Watchdog timers - runtime library) The Parma Watchdog Library (PWL) provides support for multiple, concurrent watchdog timers on systems providing setitimer(2). The PWL is currently distributed with the Parma Polyhedra Library (PPL), but is totally independent from it. ppl_0.10~pre27-3.diff.gz to pool/main/p/ppl/ppl_0.10~pre27-3.diff.gz ppl_0.10~pre27-3.dsc to pool/main/p/ppl/ppl_0.10~pre27-3.dsc Changes: ppl (0.10~pre27-3) unstable; urgency=low . * Properly install ppl-config into libppl-dev package, including man page, dont't put it into libppl7, removed ppl_lcdd from -dev, is in libppl7 Override entries for your package: libppl-c0_0.10~pre27-3_i386.deb - optional libs libppl-dev_0.10~pre27-3_i386.deb - optional libdevel libppl-doc_0.10~pre27-3_all.deb - optional doc ppl_0.10~pre27-3.dsc - source libs Announcing to [EMAIL PROTECTED] Your package contains new components which requires manual editing of the override file. It is ok otherwise, so please be patient. New packages are usually added to the override file about once a week. You may have gotten the distribution wrong. You'll get warnings above if files already exist in other distributions. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]