1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 5 extern void h (const char *p, const char *f); 6 int main(void)7main (void) 8 { 9 h (0, "foo"); 10 return 0; 11 } 12 13 void h(const char * p,const char * f)14h (const char *p, const char *f) 15 { 16 size_t pl = p == NULL ? 0 : strlen (p); 17 size_t fl = strlen (f) + 1; 18 char a[pl + 1 + fl]; 19 char *cp = a; 20 char b[pl + 5 + fl * 2]; 21 char *cccp = b; 22 if (p != NULL) 23 { 24 cp = memcpy (cp, p, pl); 25 *cp++ = ':'; 26 } 27 memcpy (cp, f, fl); 28 strcpy (b, a); 29 puts (a); 30 } 31 /* { dg-output "foo" } */ 32