aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/realloc-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-interop.c4
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-1.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-2.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-3.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119616.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119618.c21
7 files changed, 131 insertions, 3 deletions
diff --git a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
index 04925cf..0bb846c 100644
--- a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
@@ -92,5 +92,5 @@ void test_9 (void *p)
void test_10 (char *s, int n)
{
__builtin_realloc(s, n); /* { dg-warning "ignoring return value of '__builtin_realloc' declared with attribute 'warn_unused_result'" "" { target c } } */
- /* { dg-warning "ignoring return value of 'void\\* __builtin_realloc\\(void\\*, (long )?unsigned int\\)' declared with attribute 'warn_unused_result'" "" { target c++ } .-1 } */
+ /* { dg-warning "ignoring return value of 'void\\* __builtin_realloc\\(void\\*, (long )*unsigned int\\)' declared with attribute 'warn_unused_result'" "" { target c++ } .-1 } */
} /* { dg-warning "leak" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
index 1211450..e9b1ed4 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
@@ -39,6 +39,6 @@ test (int *a, int *b)
return x;
}
-/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, interopobjs\.\[0-9\]+, tgt_tgtsync\.\[0-9\]+," "gimple" } } */
-/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, interopobjs\.\[0-9\]+," "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+," "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, &interopobjs\.\[0-9\]+," "gimple" } } */
/* { dg-final { scan-tree-dump "repl1 \\(obj1, interop\.\[0-9\]+, interop\.\[0-9\]+\\)" "gimple" } } */
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);
+ }
+}