1 /* Copyright (C) 2000 Free Software Foundation.
3 Ensure all expected transformations of builtin strcat occur and
6 Written by Kaveh R. Ghazi, 11/27/2000. */
8 extern void abort (void);
9 typedef __SIZE_TYPE__
size_t;
10 extern char *strcat (char *, const char *);
11 extern char *strcpy (char *, const char *);
12 extern char *strcmp (const char *, const char *);
16 const char *const s1
= "hello world";
17 const char *const s2
= "";
21 if (strcat (dst
, "") != dst
|| strcmp (dst
, s1
))
24 if (strcat (dst
, s2
) != dst
|| strcmp (dst
, s1
))
26 strcpy (dst
, s1
); d2
= dst
;
27 if (strcat (++d2
, s2
) != dst
+1 || d2
!= dst
+1 || strcmp (dst
, s1
))
29 strcpy (dst
, s1
); d2
= dst
;
30 if (strcat (++d2
+5, s2
) != dst
+6 || d2
!= dst
+1 || strcmp (dst
, s1
))
32 strcpy (dst
, s1
); d2
= dst
;
33 if (strcat (++d2
+5, s1
+11) != dst
+6 || d2
!= dst
+1 || strcmp (dst
, s1
))
36 /* Test at least one instance of the __builtin_ style. We do this
37 to ensure that it works and that the prototype is correct. */
39 if (__builtin_strcat (dst
, "") != dst
|| strcmp (dst
, s1
))
46 /* When optimizing, all the above cases should be transformed into
47 something else. So any remaining calls to the original function
50 strcat (char *s1
, const char *s2
)