Add test for PR tree-optimization/92879.
gcc/testsuite/ChangeLog: PR tree-optimization/92879 * g++.dg/warn/Warray-bounds-16.C: New test.
This commit is contained in:
parent
1f5c80883e
commit
21c6ad7a12
29
gcc/testsuite/g++.dg/warn/Warray-bounds-16.C
Normal file
29
gcc/testsuite/g++.dg/warn/Warray-bounds-16.C
Normal file
@ -0,0 +1,29 @@
|
||||
/* PR tree-optimization/92879 - incorrect warning of __builtin_memset
|
||||
offset is out of the bounds on zero-size allocation and initialization
|
||||
{ dg-do compile }
|
||||
{ dg-options "-O2 -Wall -fdump-tree-optimized" } */
|
||||
|
||||
inline void* operator new (__SIZE_TYPE__, void * v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int* p;
|
||||
int m;
|
||||
|
||||
S (int i)
|
||||
{
|
||||
m = i;
|
||||
p = (int*) new unsigned char [sizeof (int) * m];
|
||||
|
||||
for (int i = 0; i < m; i++)
|
||||
new (p + i) int ();
|
||||
}
|
||||
};
|
||||
|
||||
S a (0);
|
||||
|
||||
/* Verify the loop has been eliminated.
|
||||
{ dg-final { scan-tree-dump-not "goto" "optimized" } } */
|
Loading…
Reference in New Issue
Block a user