comp.lang.ada
 help / color / mirror / Atom feed
* Exception propagation with optimization flags
@ 2006-10-03 22:18 ldb
  2006-10-04 12:36 ` Stephen Leake
  0 siblings, 1 reply; 5+ messages in thread
From: ldb @ 2006-10-03 22:18 UTC (permalink / raw)


Can someone explain why this particular combinations of build flags
causes exceptions to stop propagating. I'm kind of at a loss for this.
This is a nested function, which raises, catches, prints some info and
reraises an exception, and a main program which is trying to catch this
exception, to print some further information. I've created a "minimal"
program to show the problem. This is gnatmake/gcc 3.4.5.

And, if anyone is an expert, can you explain to me the connection (if
there is one) with "libunwind-exceptions" in my gcc ./configure.

When I build with -O2 and -fomit-frame-pointer I get this:
EXCEPTION

raised SUPER.AWESOME.AWESOME_EXCEPTION : super.adb:12

If I remove -fomit-frame-pointer _or_ go down to -O1 (both o2 and fomit
are required to get the behavior), I get this:
EXCEPTION
HOLY MOLY


---------------------
with Ada.Text_Io; use Ada.Text_Io;

procedure Super is

   procedure Awesome is
      Awesome_Exception : exception;
   begin
      raise Awesome_Exception;
   exception
      when others =>
         Put_Line("EXCEPTION");
         raise Awesome_Exception;
   end Awesome;


begin
   Awesome;
exception
   when others=>
      Put_Line("HOLY MOLY");
end Super;
---------------------




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-04 16:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-03 22:18 Exception propagation with optimization flags ldb
2006-10-04 12:36 ` Stephen Leake
2006-10-04 13:31   ` ldb
2006-10-04 15:09     ` Georg Bauhaus
2006-10-04 16:33     ` Stefan Bellon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox