http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49243
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2011-05-31
22:49:36 UTC ---
Comparing tree dumps from gcc-4.7 on a reduced compile-only test case shows
that the code that calls _setjmp (a) and the code that calls my_setjmp (b)
start to differ after 019t.inline_param1:
--- a/pr49243.c.019t.inline_param1 2011-05-31 23:29:47.000000000 +0200
+++ b/pr49243.c.019t.inline_param1 2011-05-31 23:30:10.000000000 +0200
@@ -4,7 +4,7 @@
Analyzing function body size: wrapper
-Inline summary for wrapper/0
+Inline summary for wrapper/0 inlinable
self time: 33
global time: 0
self size: 16
Adding -Winline one finds that the code that calls _setjmp is marked
non-inlinable because setjmp_call_p says so in inline_forbidden_p_stmt,
however it doesn't say so for the code that calls my_setjmp. setjmp_call_p
calls special_function_p, which only looks at the spelling of the function.
The closely related flags_from_decl_or_type does look at both attributes and
spelling; the following crude patch to make setjmp_call_p call the latter
instead fixes the reduced test case for me:
--- gcc-4.7-20110528/gcc/calls.c.~1~ 2011-05-25 13:00:14.000000000 +0200
+++ gcc-4.7-20110528/gcc/calls.c 2011-06-01 00:02:13.000000000 +0200
@@ -554,7 +554,7 @@ special_function_p (const_tree fndecl, i
int
setjmp_call_p (const_tree fndecl)
{
- return special_function_p (fndecl, 0) & ECF_RETURNS_TWICE;
+ return flags_from_decl_or_type (fndecl) & ECF_RETURNS_TWICE;
}
(This is a tad expensive and can be optimized.)
The other calls to special_function_p () look safe though.