Hi, all

    It seems that gcc's auto-omit-frame-pointer has other problems.

The example is from mingw bug tracker: http://sourceforge.net/tracker/?func=detail&aid=3426555&group_id=2435&atid=102435

    g++ -O3 main.cpp       running will crash.
    g++ -O2 main.cpp       running no crash.
    g++ -O3 -fno-omit-frame-pointer    running no crash.

I don't know in the end which optimize option defaultly contains this switch "-fomit-frame-pointer" on i686-pc-mingw32 or x86_64-w64-mingw32?

--
Best Regards,
xunxun

#include <vector>

typedef void (*Func)(char*);

bool lie = false;
Func dummy = 0;

void moveToWindowsRecycler(const std::vector<int>& filesToDelete = 
std::vector<int>())  //throw FileError
{
    if (!lie)
        throw 1;

    char errorMessage[20000];

    Func fun = lie ?  dummy : 0;
    fun(errorMessage);

    std::vector<int> fileNames;

    for (std::vector<int>::const_iterator iter = filesToDelete.begin(); iter != 
filesToDelete.end(); ++iter)
        fileNames.push_back(*iter);
}

void wgfdfsdgfsdgfsdg()  //throw FileError
{
    ::moveToWindowsRecycler();  //throw FileError
}

int main()
{
    try
    {
        moveToWindowsRecycler()  ;//throw FileError
    }
    catch (...) {}

    return 0;
}

Reply via email to