public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47490] New: __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
@ 2011-01-27 14:47 cyp561 at gmail dot com
2011-01-28 23:58 ` [Bug c++/47490] " mikpe at it dot uu.se
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: cyp561 at gmail dot com @ 2011-01-27 14:47 UTC (permalink / raw)
To: gcc-bugs
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();
}
-----
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/47490] __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
2011-01-27 14:47 [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
@ 2011-01-28 23:58 ` mikpe at it dot uu.se
2011-01-30 2:48 ` mikpe at it dot uu.se
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mikpe at it dot uu.se @ 2011-01-28 23:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47490
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2011-01-28 23:01:37 UTC ---
I can reproduce the failure on i686-linux when gcc-4.4.5 is configured with
--enable-languages=c,c++ --disable-dwarf2 --enable-sjlj-exceptions, mimicking
mingw/mingw-w64. gcc-4.5.2 appears to work though.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/47490] __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
2011-01-27 14:47 [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
2011-01-28 23:58 ` [Bug c++/47490] " mikpe at it dot uu.se
@ 2011-01-30 2:48 ` mikpe at it dot uu.se
2011-04-12 19:44 ` ktietz at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mikpe at it dot uu.se @ 2011-01-30 2:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47490
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2011-01-30 01:23:33 UTC ---
Fixed on trunk for 4.5 by r146570:
Author: uweigand
Date: Wed Apr 22 11:31:56 2009
New Revision: 146570
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146570
Log:
* function.c (expand_function_end): Do not emit a jump to the "naked"
return label for fall-through returns.
* except.c (sjlj_emit_function_exit): Always place the call to the
unregister function at the location installed by expand_function_end.
This seems to have been intended to fix SJLJ miscompilation on SPU, see the
thread starting <http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01265.html>.
Backporting this change to 4.4.5 solves the test case failure there too.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/47490] __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
2011-01-27 14:47 [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
2011-01-28 23:58 ` [Bug c++/47490] " mikpe at it dot uu.se
2011-01-30 2:48 ` mikpe at it dot uu.se
@ 2011-04-12 19:44 ` ktietz at gcc dot gnu.org
2011-04-12 19:45 ` ktietz at gcc dot gnu.org
2011-04-12 19:46 ` ktietz at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-04-12 19:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47490
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc at david dot
| |osborn.name
--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-04-12 19:44:10 UTC ---
*** Bug 30047 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/47490] __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
2011-01-27 14:47 [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
` (2 preceding siblings ...)
2011-04-12 19:44 ` ktietz at gcc dot gnu.org
@ 2011-04-12 19:45 ` ktietz at gcc dot gnu.org
2011-04-12 19:46 ` ktietz at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-04-12 19:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47490
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hilmar.ackermann at
| |googlemail dot com
--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-04-12 19:45:09 UTC ---
*** Bug 48519 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/47490] __Unwind_SjLj_Unregister clobbers return value with i586-mingw32msvc-g++ 4.4.4 and -fstack-protector
2011-01-27 14:47 [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
` (3 preceding siblings ...)
2011-04-12 19:45 ` ktietz at gcc dot gnu.org
@ 2011-04-12 19:46 ` ktietz at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-04-12 19:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47490
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |ktietz at gcc dot gnu.org
Resolution| |FIXED
--- Comment #5 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-04-12 19:46:06 UTC ---
Confirmed bug is fixed beginning with 4.4.5
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-12 19:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 14:47 [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
2011-01-28 23:58 ` [Bug c++/47490] " mikpe at it dot uu.se
2011-01-30 2:48 ` mikpe at it dot uu.se
2011-04-12 19:44 ` ktietz at gcc dot gnu.org
2011-04-12 19:45 ` ktietz at gcc dot gnu.org
2011-04-12 19:46 ` ktietz at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).