* 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
* Re: Exception propagation with optimization flags
2006-10-03 22:18 Exception propagation with optimization flags ldb
@ 2006-10-04 12:36 ` Stephen Leake
2006-10-04 13:31 ` ldb
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Leake @ 2006-10-04 12:36 UTC (permalink / raw)
"ldb" <ldb_nospam@hotmail.com> writes:
> Can someone explain why this particular combinations of build flags
> causes exceptions to stop propagating.
You need to say what compiler and OS you are using, and give the
complete command lines.
--
-- Stephe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exception propagation with optimization flags
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
0 siblings, 2 replies; 5+ messages in thread
From: ldb @ 2006-10-04 13:31 UTC (permalink / raw)
Stephen Leake wrote:
> "ldb" <ldb_nospam@hotmail.com> writes:
>
> > Can someone explain why this particular combinations of build flags
> > causes exceptions to stop propagating.
>
> You need to say what compiler and OS you are using, and give the
> complete command lines.
>
> --
> -- Stephe
I did, I thought.
gnatmake 3.4.5 (Red Hat 3.4.5-2)
Linux (Red Hat)
gnatmake -fomit-frame-pointer -O2 super.adb (doesn't work)
gnatmake -fomit-frame-pointer -O1 super.adb (works)
gnatmake -O2 super.adb (works)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exception propagation with optimization flags
2006-10-04 13:31 ` ldb
@ 2006-10-04 15:09 ` Georg Bauhaus
2006-10-04 16:33 ` Stefan Bellon
1 sibling, 0 replies; 5+ messages in thread
From: Georg Bauhaus @ 2006-10-04 15:09 UTC (permalink / raw)
On Wed, 2006-10-04 at 06:31 -0700, ldb wrote:
> Stephen Leake wrote:
> > "ldb" <ldb_nospam@hotmail.com> writes:
> >
> > > Can someone explain why this particular combinations of build flags
> > > causes exceptions to stop propagating.
> gnatmake -fomit-frame-pointer -O2 super.adb (doesn't work)
> gnatmake -fomit-frame-pointer -O1 super.adb (works)
> gnatmake -O2 super.adb (works)
>
And, earlier,
> And, if anyone is an expert, can you explain to me the connection (if
> there is one) with "libunwind-exceptions" in my gcc ./configure.
A good place to ask is probably the GCC mailing list. Specific
GCC configurations and their effects on front-ends are probably
best known there. A vanilla GCC 42 with Ada enabled compiles
your programs such that it prints/handles exceptions as
expected.
-- Georg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exception propagation with optimization flags
2006-10-04 13:31 ` ldb
2006-10-04 15:09 ` Georg Bauhaus
@ 2006-10-04 16:33 ` Stefan Bellon
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Bellon @ 2006-10-04 16:33 UTC (permalink / raw)
ldb wrote:
> gnatmake -fomit-frame-pointer -O2 super.adb (doesn't work)
> gnatmake -fomit-frame-pointer -O1 super.adb (works)
> gnatmake -O2 super.adb (works)
I recently had a similar problem on Solaris 8 using the GNU ld/as
instead of the Sun ones. In that case, static linking didn't catch
exceptions. However when I added "-bargs -shared" to the gnatmake call,
the exceptions were caught again. Using the Sun ld/as instead of the
GNU ld/as however catches exceptions regardless of whether linking
-static or -shared.
--
Stefan Bellon
^ 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