[Bug c++/47490] New: __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
cyp561 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 27 14:47:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47490
Summary: __Unwind_SjLj_Unregister clobbers return value with
i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
Product: gcc
Version: 4.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: cyp561@gmail.com
Host: Ubuntu, 64-bit
Target: i586-mingw32msvc
Wrong code:
i586-mingw32msvc-g++ (GCC) 4.4.4 (on Ubuntu)
Correct code:
i586-mingw32msvc-g++ (Gentoo 4.5.2 p1.0, pie-0.4.5) 4.5.2
Build with:
i586-mingw32msvc-g++ -O0 -fstack-protector -o wtf.exe wtf.cpp
Apparent problem:
The function theCompilerWorks() returns false due to the return value true in
the al register being clobbered by __Unwind_SjLj_Unregister.
The problem only occurs at -O0 in this test case, but the original program
fails at -O2.
May be related to:
Bug 30047 mentions a return value being clobbered by __Unwind_SjLj_Unregister.
Testcase:
-----
extern "C" void abort(void);
void a() {}
void (*volatile doNothing)() = a;
struct TheCompilerWorks
{
TheCompilerWorks() {}
~TheCompilerWorks() {}
char unusedArray[340];
};
bool theCompilerWorks()
{
TheCompilerWorks harmlessObject;
doNothing();
return true;
}
int main()
{
if (!theCompilerWorks())
abort();
}
-----
More information about the Gcc-bugs
mailing list