Commit 0a22f996 by Martin Sebor Committed by Martin Sebor

PR middle-end/79221 - missing -Wstringop-overflow= on a strcat overflow

gcc/testsuite/ChangeLog:
	* gcc.dg/Wstringop-overflow-26.c: New test.

From-SVN: r279227
parent ddd0fd17
2019-12-11 Martin Sebor <msebor@redhat.com>
PR middle-end/79221
* gcc.dg/Wstringop-overflow-26.c: New test.
2019-12-11 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc.dg/vect/vect-epilogues.c: Remove xfail for arm.
......
/* PR middle-end/79221 - missing -Wstringop-overflow= on a strcat overflow
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
extern char* strcat (char*, const char*);
char d[3];
void f (int i)
{
const char *s = i < 0 ? "01234567" : "89abcd";
strcat (d, s); // { dg-warning "'strcat' writing between 7 and 9 bytes into a region of size 3" } */
}
void g (int i)
{
const char *s = i < 0 ? "12345678" : "87654321";
strcat (d, s); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment