2 { dg-options "-O2 -Wall" } */
4 typedef __SIZE_TYPE__
size_t;
7 void* memcpy (void*, const void*, size_t);
8 size_t strlen (const char *);
10 // Test case reduced from gcc/attribs.c.
12 char* sorted_attr_string (char *argv
[])
17 for (i
= 0; argv
[i
]; ++i
)
18 n
+= strlen (argv
[i
]);
20 char *s
= (char*)malloc (n
);
22 for (i
= 0; argv
[i
]; ++i
)
24 const char *str
= argv
[i
];
25 size_t len
= strlen (str
);
26 memcpy (s
+ n
, str
, len
);
30 /* Replace "=,-" with "_". */
31 for (i
= 0; i
< strlen (s
); i
++)
33 s
[i
] = '_'; // { dg-bogus "\\\[-Wstringop-overflow" }
41 void nowarn_cond_escape (int c
, int *x
)
43 extern char a3
[3], a5
[5];
57 f (p
); // may modify *x
62 p
[4] = 0; // { dg-bogus "\\\[-Wstringop-overflow" }
65 void warn_cond_escape (int c
, int *x
)
68 extern char a5_2
[5]; // { dg-message "at offset 5 into object 'a5_2'" }
82 f (p
); // may modify *x
87 p
[5] = 0; // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }