* tree-inline.c (inline_forbidden_p_1): Prevent inlining functions
that call __builtin_return or __builtin_apply_args.
* gcc.dg/builtin-apply4.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97653
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-04-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/20076
+ * tree-inline.c (inline_forbidden_p_1): Prevent inlining functions
+ that call __builtin_return or __builtin_apply_args.
+
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/20076
+ * gcc.dg/builtin-apply4.c: New test.
+
PR preprocessor/19475
* gcc.dg/cpp/macspace1.c: New test.
* gcc.dg/cpp/macspace2.c: New test.
--- /dev/null
+/* PR tree-optimization/20076 */
+/* { dg-options "-O2" } */
+/* { dg-do run } */
+
+extern void abort (void);
+
+double
+foo (int arg)
+{
+ if (arg != 116)
+ abort();
+ return arg + 1;
+}
+
+inline double
+bar (int arg)
+{
+ foo (arg);
+ __builtin_return (__builtin_apply ((void (*) ()) foo,
+ __builtin_apply_args (), 16));
+}
+
+int
+main (int argc, char **argv)
+{
+ if (bar (116) != 117.0)
+ abort ();
+
+ return 0;
+}
"it uses non-local goto");
return node;
+ case BUILT_IN_RETURN:
+ case BUILT_IN_APPLY_ARGS:
+ /* If a __builtin_apply_args caller would be inlined,
+ it would be saving arguments of the function it has
+ been inlined into. Similarly __builtin_return would
+ return from the function the inline has been inlined into. */
+ inline_forbidden_reason
+ = N_("%Jfunction %qF can never be inlined because "
+ "it uses __builtin_return or __builtin_apply_args");
+ return node;
+
default:
break;
}