From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8f7b0ead76cf5827,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mail From: "ldb" Newsgroups: comp.lang.ada Subject: Exception propagation with optimization flags Date: 3 Oct 2006 15:18:19 -0700 Organization: http://groups.google.com Message-ID: <1159913899.620229.69760@m73g2000cwd.googlegroups.com> NNTP-Posting-Host: 206.210.81.52 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1159913905 2636 127.0.0.1 (3 Oct 2006 22:18:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 3 Oct 2006 22:18:25 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m73g2000cwd.googlegroups.com; posting-host=206.210.81.52; posting-account=V3awPg0AAAB11Uk1Sshvlrxz0peUf-At Xref: g2news2.google.com comp.lang.ada:6855 Date: 2006-10-03T15:18:19-07:00 List-Id: 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; ---------------------