Commit ab3c292e by Martin Sebor Committed by Martin Sebor

PR tree-optimization/84053 - missing -Warray-bounds accessing a local array…

PR tree-optimization/84053 - missing -Warray-bounds accessing a local array across inlined function boundaries

gcc/testsuite/ChangeLog:
	* gcc.dg/Warray-bounds-36.c: New test.

From-SVN: r267302
parent 573767d4
2018-12-20 Martin Sebor <msebor@redhat.com>
PR tree-optimization/84053
* gcc.dg/Warray-bounds-36.c: New test.
2018-12-20 David Malcolm <dmalcolm@redhat.com>
PR c++/87504
......
/* PR tree-optimization/84053] missing -Warray-bounds accessing
a local array across inlined function boundaries
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
int deref (const int *p, int i)
{
return p[i]; // { dg-warning "array subscript \\\[3, \[0-9\]+] is outside array bounds of .int\\\[2\\\]." "ilp33" { xfail ilp32 } }
// There should also be an inlining context here. PR 86650 tracks
// its absence.
}
int deref_3_plus (const int *p, int i)
{
if (i < 3)
i = 3;
return deref (p, i);
}
int deref_a (int i)
{
int a[] = { 2, 3 };
return deref_3_plus (a, i);
}
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