Use the recursive form of compute_objsize [PR 103143].
gcc/ChangeLog: PR middle-end/103143 * pointer-query.cc (gimple_call_return_array): Call compute_objsize_r. gcc/testsuite/ChangeLog: PR middle-end/103143 * gcc.dg/Wstringop-overflow-83.c: New test.
This commit is contained in:
parent
6a071b2d40
commit
425a39fd4e
2 changed files with 20 additions and 1 deletions
|
@ -199,7 +199,7 @@ gimple_call_return_array (gimple *stmt, offset_int offrng[2], bool *past_end,
|
|||
of the source object. */
|
||||
access_ref aref;
|
||||
tree src = gimple_call_arg (stmt, 1);
|
||||
if (compute_objsize (src, stmt, 1, &aref, qry)
|
||||
if (compute_objsize_r (src, stmt, 1, &aref, snlim, qry)
|
||||
&& aref.sizrng[1] < offrng[1])
|
||||
offrng[1] = aref.sizrng[1];
|
||||
}
|
||||
|
|
19
gcc/testsuite/gcc.dg/Wstringop-overflow-83.c
Normal file
19
gcc/testsuite/gcc.dg/Wstringop-overflow-83.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* PR middle-end/103143 - ICE due to infinite recursion in pointer-query.cc
|
||||
{ dg-do compile }
|
||||
{ dg-options "-O2 -Wall" } */
|
||||
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
void foo (size_t x)
|
||||
{
|
||||
struct T { char buf[64]; char buf2[64]; } t;
|
||||
char *p = &t.buf[8];
|
||||
char *r = t.buf2;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < x; i++)
|
||||
{
|
||||
r = __builtin_mempcpy (r, p, i);
|
||||
p = r + 1;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue