This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Non-call-exceptions, unwinding and g++ optimization levels

On Wed, Jan 21, 2015 at 12:13 PM, Jorge BellÃn Castro
<> wrote:
> Good day,
> I'm working with exceptions thrown by a signal handler using
> -fnon-call-exceptions flag with g++ for x86_64.
> The problem I am facing is that the behavior of this mechanism is not
> consistent if we change some optimization options, that is, the result
> of a given program can be different. In order to make a comparison, I
> ran this test several times, each with different optimizations
> enabled.
> Compilation either with -O0 or without any flags (just -fnon-call-exceptions):
> Exception is caught at the "copy" function (the one which calls
> std::copy). This is the expected behavior.
> Compilation using -O1 -O2 or -O3 flag directly:
> Exception is not being caught.
> If both -fno-inline and -fno-ipa-pure-const are used, then the program
> behaves as if -O0 is used. Thus, I tried to add
> __attribute__((noinline)) to both "foo" and "copy" functions. It seems
> that they were ignored because the problem doesn't dissapear when
> -fno-inline is not used.
> In my opinion, it seems that catch blocks are being optimized out or
> that, because of the inlining, the generated code is not able to find
> any catch blocks inside its scope.
> I could reproduce this with g++ versions 4.7.3, 4.8.1 and the latest
> in the public, read-only, git. The file used to test this is attached
> to the message. Compile command used is:
>    g++ -fnon-call-exceptions [-fno-inline -fno-ipa-pure-const] -O{0,1,2,3}

Please open a bugreport.


> Regards,
>  Jorge

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]