1 /* PR middle-end/93646 - confusing -Wstringop-truncation on strncat where
2 -Wstringop-overflow is expected
4 { dg-options "-O2 -Wall" } */
6 extern __SIZE_TYPE__
strlen (const char*);
7 extern char* strncat (char*, const char*, __SIZE_TYPE__
);
13 void f0 (char *d
, const char *s
)
15 strncat (d
, s
, strlen (s
)); // { dg-warning "specified bound depends on the length of the source argument" }
16 /* { dg-message "function 'f0'.*inlined from 'f1'" "inlining stack" { target *-*-* } 0 } */
18 // Prevent f0 from being replaced by g0.
22 void f1 (const char *s
)
28 static void g0 (char *d
, const char *s
)
30 strncat (d
, s
, strlen (s
)); // { dg-warning "specified bound 3 equals source length" }
31 /* { dg-message "function 'g0'.*inlined from 'g1'" "inlining stack" { target *-*-* } 0 } */
33 // Prevent g0 from being replaced by f0.