[Bug 5174] Uncatchable C++ exceptions with NPTL on ARM and -fomit-frame-pointer

bugzilla at busybox.net bugzilla at busybox.net
Wed Oct 15 19:43:01 UTC 2014


https://bugs.busybox.net/show_bug.cgi?id=5174

--- Comment #10 from Ralph Siemsen <ralphs at netwinder.org> 2014-10-15 19:42:59 UTC ---
I've just stumbled across the same bug, thought it took several days to narrow
it down and eventually find this bug report.

The symptoms are practically identical:
- cross-compiling for ARM target
- executable is linked with -lpthread (even when it doesn't use threads)
- throw() occurs in a subroutine, not in the try/catch block.
- the subroutine allocates some local object too (likely avoids inlining)
- compile with -O1 or higher, which enables -fomit-frame-pointer.
- uClibc-0.9.33.2, NPTL

Differences:
- I can trigger the SIGABRT in a single compilation unit.
- The catch block can match the thrown exception, or it can be "..." (both
fail)
- I'm targeting cortex A9 rather than A8.
- I've used buildroot 2013.08 and also 2014.08, both failed.
- External toolchains from Codesourcery do not have this problem.

Here's my test program. It crashes with SIGABRT if the above conditions are
met. If compiled with -O0 or -fno-omit-frame-pointer then it runs fine and
prints "CATCH" as expected.

/*
 * arm-linux-gcc -O1 -Wall -o cpptest cpptest.cpp -lpthread
 */
#include <iostream>
#include <string>
#include <sstream>
#include <stdexcept>

void subroutine(void) throw(std::out_of_range)
{
        std::ostringstream strStream;
        throw std::out_of_range("foobar");
}

int main()
{
        try
        {
                subroutine();
        }
        catch (...)  // catch (std::out_of_range) also fails
        {
                std::cerr << "CATCH" << std::endl;
        }
        return 0;
}


Please let me know if I can provide any more debug info.

I'm also testing the patch from comment 9, however so far it does not seem to
fix the issue for me.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list