aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr119483-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr119483-1.c')
-rw-r--r--gcc/testsuite/c-c++-common/pr119483-1.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr119483-1.c b/gcc/testsuite/c-c++-common/pr119483-1.c
new file mode 100644
index 0000000..b2d7b57
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119483-1.c
@@ -0,0 +1,29 @@
+/* PR tree-optimization/119483 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "baz \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+[[gnu::noreturn]] extern void foo (void);
+
+[[gnu::noinline]] static int
+bar (int x)
+{
+ (void) x;
+ foo ();
+ return 0;
+}
+
+[[gnu::noipa]] int
+baz (int x)
+{
+ return x + 42;
+}
+
+int
+qux (int x)
+{
+ if (x == 1)
+ [[gnu::musttail]] return bar (1);
+ [[gnu::musttail]] return baz (x);
+}