Commit 77efc5c2 by Martin Sebor Committed by Martin Sebor

PR middle-end/88273 - [8/9 Regression] warning: 'memcpy' offset [-527, -529]

PR middle-end/88273 - [8/9 Regression] warning: 'memcpy' offset [-527, -529]
is out of the bounds [0, 16]

gcc/ChangeLog:

	PR middle-end/88273
	* gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range):
	Handle anti-ranges the same as no range at all.

gcc/testsuite/ChangeLog:

	PR middle-end/88273
	* gcc.dg/Warray-bounds-38.c: New test.

From-SVN: r268048
parent 17ad43dd
2019-01-17 Martin Sebor <msebor@redhat.com>
PR middle-end/88273
* gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range):
Handle anti-ranges the same as no range at all.
2018-01-17 Steve Ellcey <sellcey@cavium.com> 2018-01-17 Steve Ellcey <sellcey@cavium.com>
* config/aarch64/aarch64.c (cgraph.h): New include. * config/aarch64/aarch64.c (cgraph.h): New include.
......
...@@ -319,13 +319,9 @@ builtin_memref::extend_offset_range (tree offset) ...@@ -319,13 +319,9 @@ builtin_memref::extend_offset_range (tree offset)
offrange[0] += offset_int::from (min, SIGNED); offrange[0] += offset_int::from (min, SIGNED);
offrange[1] += offset_int::from (max, SIGNED); offrange[1] += offset_int::from (max, SIGNED);
} }
else if (rng == VR_ANTI_RANGE)
{
offrange[0] += offset_int::from (max + 1, SIGNED);
offrange[1] += offset_int::from (min - 1, SIGNED);
}
else else
{ {
/* Handle an anti-range the same as no range at all. */
gimple *stmt = SSA_NAME_DEF_STMT (offset); gimple *stmt = SSA_NAME_DEF_STMT (offset);
tree type; tree type;
if (is_gimple_assign (stmt) if (is_gimple_assign (stmt)
......
2019-01-17 Martin Sebor <msebor@redhat.com>
PR middle-end/88273
* gcc.dg/Warray-bounds-38.c: New test.
2018-01-17 Steve Ellcey <sellcey@cavium.com> 2018-01-17 Steve Ellcey <sellcey@cavium.com>
* c-c++-common/gomp/pr60823-1.c: Add aarch64 specific * c-c++-common/gomp/pr60823-1.c: Add aarch64 specific
......
/* PR middle-end/88273 - bogus warning: 'memcpy' offset [-527, -529]
is out of the bounds [0, 16]
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
typedef __SIZE_TYPE__ size_t;
void *q;
size_t x, y;
inline void f (char *p, int i, size_t j)
{
size_t n = y ? y : j;
p += x - i;
__builtin_memcpy (q, p, n); /* { dg-bogus "bounds" } */
x = n;
}
void g (void)
{
struct { char a[16]; } s;
f (q, 0, sizeof s);
f (s.a, 33 * sizeof s, 1);
}
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