mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 19:51:34 +08:00
PR middle-end/81401 - false positive -Wformat-overflow in a loop
gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/builtin-sprintf-warn-24.c: New test.
This commit is contained in:
parent
97bd1d6b51
commit
3ca63e1c76
@ -1,3 +1,8 @@
|
||||
2020-03-04 Martin Sebor <msebor@redhat.com>
|
||||
|
||||
PR middle-end/81401
|
||||
* gcc.dg/tree-ssa/builtin-sprintf-warn-24.c: New test.
|
||||
|
||||
2020-03-04 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* gcc.target/powerpc/20050603-3.c: Remove XFAILS.
|
||||
|
22
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-24.c
Normal file
22
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-24.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* PR middle-end/81401 - false positive -Wformat-overflow in a loop
|
||||
{ dg-do compile }
|
||||
{ dg-options "-O2 -Wall -Wformat-overflow" } */
|
||||
|
||||
char a[3];
|
||||
|
||||
void f (void)
|
||||
{
|
||||
int i, i0 = 0x00;
|
||||
|
||||
for (i = i0; i <= 0xff; ++i)
|
||||
__builtin_sprintf (a, "%02x", i); // { dg-bogus "\\\[-Wformat-overflow" }
|
||||
}
|
||||
|
||||
char b[2];
|
||||
|
||||
void g (void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; ++i)
|
||||
__builtin_sprintf (b, "%d", i); // { dg-bogus "\\\[-Wformat-overflow" }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user