1 /* PR tree-optimization/93262 */
2
3 extern void abort (void);
4 typedef __SIZE_TYPE__ size_t;
5 extern void *memcpy (void *, const void *, size_t);
6 extern void *memset (void *, int, size_t);
7
8 #include "chk.h"
9
10 char b[32] = "def";
11 char a[32] = "abc";
12 char c[32] = "ghi";
13 int l1;
14
15 __attribute__((noipa, noinline, noclone, optimize ("tree-dse"))) void
foo(char * b)16 foo (char *b)
17 {
18 memcpy (a, b, 48);
19 memset (a, ' ', 16);
20 }
21
22 __attribute__((noipa, noinline, noclone, optimize ("tree-dse"))) void
bar(void)23 bar (void)
24 {
25 memset (a, ' ', 48);
26 memset (a, '0', 16);
27 }
28
29 void
main_test(void)30 main_test (void)
31 {
32 #ifndef __OPTIMIZE__
33 /* Object size checking is only intended for -O[s123]. */
34 return;
35 #endif
36 __asm ("" : "=r" (l1) : "0" (l1));
37 chk_calls = 0;
38 chk_fail_allowed = 1;
39 /* Runtime checks. */
40 if (__builtin_setjmp (chk_fail_buf) == 0)
41 {
42 foo ("0123456789abcdeffedcba9876543210ghijklmnopqrstuv");
43 if (!l1)
44 abort ();
45 }
46 if (__builtin_setjmp (chk_fail_buf) == 0)
47 {
48 bar ();
49 if (!l1)
50 abort ();
51 }
52 if (chk_calls != 2)
53 abort ();
54 return 0;
55 }
56