This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug middle-end/82504] Optimize away exception allocation and throws handled by catch(...){}


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82504

--- Comment #2 from Antony Polukhin <antoshkka at gmail dot com> ---
+1. Some realistic code examples were the optimization could be very useful if
triggered after inlining:

// Destructors
bar::~bar() {
    try {
        cleanup_some_dangerous_resources();
    } catch(...) {}
}

// Logging
#define SafeLog(X) try { g_logger << X << std::endl; } catch (...){}

// Poor Try* functions
bool try_parse(const char* text) {
    try {
        parse_text(text); // throws
    } catch (...) {
        return false;
    }

    return true;
}

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