tree-optimization/104009: Conservative underflow estimate in object size
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt-31.c
blobbdd46ba0000fde537c09df45a505b23358fd60bd
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 #include "strlenopt.h"
6 __attribute__((noinline, noclone)) int
7 bar (char *p1, const char *q)
9 strcpy (p1, "abcde");
10 char *p2 = strchr (p1, '\0');
11 strcpy (p2, q);
12 char *p3 = strchr (p2, '\0');
13 memcpy (p3, "x", 2);
14 return strlen (p1);
17 int
18 main (void)
20 char buffer[10];
21 int res = bar (buffer, "foo");
22 if (strcmp (buffer, "abcdefoox") != 0 || res != 9)
23 abort ();
24 return 0;