summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20050503-1.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/20050503-1.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/20050503-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/20050503-1.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/20050503-1.c b/gcc/testsuite/gcc.dg/20050503-1.c
new file mode 100644
index 000000000..d118b9555
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20050503-1.c
@@ -0,0 +1,50 @@
+/* PR middle-end/21265
+ Test whether tail call information is propagated through builtin
+ expanders. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */
+/* { dg-options "-O2" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+#define F(n, rettype, name, args, callargs) \
+extern rettype name args; \
+rettype test##n args \
+{ \
+ return name callargs; \
+}
+#define F1(n, rettype, name, t1, callargs) \
+ F (n, rettype, name, (t1 a1), callargs)
+#define F2(n, rettype, name, t1, t2, callargs) \
+ F (n, rettype, name, (t1 a1, t2 a2), callargs)
+#define F3(n, rettype, name, t1, t2, t3, callargs) \
+ F (n, rettype, name, (t1 a1, t2 a2, t3 a3), callargs)
+
+F3 (1a, void *, memcpy, void *, const void *, size_t, (a1, a2, a3))
+F3 (1b, void *, memcpy, void *, const void *, size_t, (a1, a2, 10))
+F3 (2a, void *, mempcpy, void *, const void *, size_t, (a1, a2, a3))
+F3 (2b, void *, mempcpy, void *, const void *, size_t, (a1, a2, 10))
+F3 (3a, void *, memmove, void *, const void *, size_t, (a1, a2, a3))
+F3 (3b, void *, memmove, void *, const void *, size_t, (a1, "abcdefghijklmno", a3))
+F3 (4a, void *, memset, void *, int, size_t, (a1, a2, a3))
+F3 (4b, void *, memset, void *, int, size_t, (a1, a2, 156))
+F3 (4c, void *, memset, void *, int, size_t, (a1, 0, a3))
+F3 (4d, void *, memset, void *, int, size_t, (a1, 0, 10000))
+F3 (5a, int, memcmp, const void *, const void *, size_t, (a1, a2, a3))
+F3 (5b, int, memcmp, const void *, const void *, size_t, (a1, "abcdefghijkl", a3))
+F2 (6, char *, strcpy, char *, const char *, (a1, a2))
+F2 (7, char *, stpcpy, char *, const char *, (a1, a2))
+F3 (8, char *, strncpy, char *, const char *, size_t, (a1, a2, a3))
+F3 (9, char *, stpncpy, char *, const char *, size_t, (a1, a2, a3))
+F2 (10, char *, strcat, char *, const char *, (a1, a2))
+F3 (11, char *, strncat, char *, const char *, size_t, (a1, a2, a3))
+F1 (12a, size_t, strlen, const char *, (a1))
+F1 (12b, size_t, strlen, const char *, ("foobar"))
+F2 (13a, int, strcmp, const char *, const char *, (a1, a2))
+F2 (13b, int, strcmp, const char *, const char *, (a1, "abcdefghijklm"))
+F3 (14a, int, strncmp, const char *, const char *, size_t, (a1, a2, a3))
+F3 (14b, int, strncmp, const char *, const char *, size_t, (a1, "abcdefghijklm", 10))
+F2 (15, char *, strchr, const char *, int, (a1, a2))
+
+/* All the calls above should be tail call optimized on i?86/x86-64. */
+/* { dg-final { scan-assembler-not "call" { target i?86-*-linux* x86_64-*-linux* } } } */