diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119614-1.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119614-2.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119614-3.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119616.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119618.c | 21 |
5 files changed, 128 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr119614-1.c b/gcc/testsuite/c-c++-common/pr119614-1.c new file mode 100644 index 0000000..89105a3 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119614-1.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/119614 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +volatile int v; + +[[gnu::noinline]] const char * +foo (int x) +{ + v += x; + return 0; +} + +const char * +bar (int x) +{ + if (x == 42) + [[gnu::musttail]] return foo (42); + [[gnu::musttail]] return foo (32); +} + +const char * +baz (int x) +{ + if (x == 5) + return foo (42); + return foo (32); +} diff --git a/gcc/testsuite/c-c++-common/pr119614-2.c b/gcc/testsuite/c-c++-common/pr119614-2.c new file mode 100644 index 0000000..8833eee --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119614-2.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/119614 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +volatile int v; + +[[gnu::noinline]] const char * +foo (int x) +{ + v += x; + return (const char *) -42; +} + +const char * +bar (int x) +{ + if (x == 42) + [[gnu::musttail]] return foo (42); + [[gnu::musttail]] return foo (32); +} + +const char * +baz (int x) +{ + if (x == 5) + return foo (42); + return foo (32); +} diff --git a/gcc/testsuite/c-c++-common/pr119614-3.c b/gcc/testsuite/c-c++-common/pr119614-3.c new file mode 100644 index 0000000..59ed36b --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119614-3.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/119614 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +volatile int v; + +[[gnu::noinline]] double +foo (int x) +{ + v += x; + return 0.5; +} + +double +bar (int x) +{ + if (x == 42) + [[gnu::musttail]] return foo (42); + [[gnu::musttail]] return foo (32); +} + +double +baz (int x) +{ + if (x == 5) + return foo (42); + return foo (32); +} diff --git a/gcc/testsuite/c-c++-common/pr119616.c b/gcc/testsuite/c-c++-common/pr119616.c new file mode 100644 index 0000000..5ffdb8c --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119616.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/119616 */ +/* { dg-do compile { target external_musttail } } */ +/* { dg-options "-O2" } */ + +int foo (int *); +int bar (int); + +int +baz (int x) +{ + if (!x) + [[gnu::musttail]] return bar (x); + return foo (&x); +} + +int +qux (int x) +{ + if (!x) + [[gnu::musttail]] return bar (x); + foo (&x); + return 1; +} diff --git a/gcc/testsuite/c-c++-common/pr119618.c b/gcc/testsuite/c-c++-common/pr119618.c new file mode 100644 index 0000000..a56e669 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119618.c @@ -0,0 +1,21 @@ +/* PR gcov-profile/119618 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-fcompare-debug -fprofile-generate -O1" } */ +/* { dg-require-profiling "-fprofile-generate" } */ + +struct S { char s; }; +int foo (void); +int *(*fn) (void); + +int * +bar (void) +{ + if (foo ()) + return 0; + { + struct S s; + do + [[gnu::musttail]] return fn (); + while (0); + } +} |