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