OSDN Git Service

PR middle-end/21265
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20050503-1.c
1 /* PR middle-end/21265
2    Test whether tail call information is propagated through builtin
3    expanders.  */
4 /* { dg-do compile } */
5 /* { dg-options "-O2" } */
6
7 typedef __SIZE_TYPE__ size_t;
8
9 #define F(n, rettype, name, args, callargs) \
10 extern rettype name args;                               \
11 rettype test##n args                                    \
12 {                                                       \
13   return name callargs;                                 \
14 }
15 #define F1(n, rettype, name, t1, callargs) \
16   F (n, rettype, name, (t1 a1), callargs)
17 #define F2(n, rettype, name, t1, t2, callargs) \
18   F (n, rettype, name, (t1 a1, t2 a2), callargs)
19 #define F3(n, rettype, name, t1, t2, t3, callargs) \
20   F (n, rettype, name, (t1 a1, t2 a2, t3 a3), callargs)
21
22 F3 (1a, void *, memcpy, void *, const void *, size_t, (a1, a2, a3))
23 F3 (1b, void *, memcpy, void *, const void *, size_t, (a1, a2, 10))
24 F3 (2a, void *, mempcpy, void *, const void *, size_t, (a1, a2, a3))
25 F3 (2b, void *, mempcpy, void *, const void *, size_t, (a1, a2, 10))
26 F3 (3a, void *, memmove, void *, const void *, size_t, (a1, a2, a3))
27 F3 (3b, void *, memmove, void *, const void *, size_t, (a1, "abcdefghijklmno", a3))
28 F3 (4a, void *, memset, void *, int, size_t, (a1, a2, a3))
29 F3 (4b, void *, memset, void *, int, size_t, (a1, a2, 156))
30 F3 (4c, void *, memset, void *, int, size_t, (a1, 0, a3))
31 F3 (4d, void *, memset, void *, int, size_t, (a1, 0, 10000))
32 F3 (5a, int, memcmp, const void *, const void *, size_t, (a1, a2, a3))
33 F3 (5b, int, memcmp, const void *, const void *, size_t, (a1, "abcdefghijkl", a3))
34 F2 (6, char *, strcpy, char *, const char *, (a1, a2))
35 F2 (7, char *, stpcpy, char *, const char *, (a1, a2))
36 F3 (8, char *, strncpy, char *, const char *, size_t, (a1, a2, a3))
37 F3 (9, char *, stpncpy, char *, const char *, size_t, (a1, a2, a3))
38 F2 (10, char *, strcat, char *, const char *, (a1, a2))
39 F3 (11, char *, strncat, char *, const char *, size_t, (a1, a2, a3))
40 F1 (12a, size_t, strlen, const char *, (a1))
41 F1 (12b, size_t, strlen, const char *, ("foobar"))
42 F2 (13a, int, strcmp, const char *, const char *, (a1, a2))
43 F2 (13b, int, strcmp, const char *, const char *, (a1, "abcdefghijklm"))
44 F3 (14a, int, strncmp, const char *, const char *, size_t, (a1, a2, a3))
45 F3 (14b, int, strncmp, const char *, const char *, size_t, (a1, "abcdefghijklm", 10))
46 F2 (15, char *, strchr, const char *, int, (a1, a2))
47
48 /* All the calls above should be tail call optimized on i?86/x86-64.  */
49 /* { dg-final { scan-assembler-not "call" { target i?86-*-linux* x86_64-*-linux* } } } */