Commit ea17de23 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/51077 (Endless recursion with __builtin_object_size)

	PR middle-end/51077
	* tree-object-size.c (addr_object_size): Check TREE_CODE of
	MEM_REF's operand rather than code of the MEM_REF itself.

	* gcc.c-torture/compile/pr51077.c: New test.

From-SVN: r181263
parent 8851b429
2011-11-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/51077
* tree-object-size.c (addr_object_size): Check TREE_CODE of
MEM_REF's operand rather than code of the MEM_REF itself.
2011-11-10 Andrew MacLeod <amacleod@redhat.com> 2011-11-10 Andrew MacLeod <amacleod@redhat.com>
PR rtl-optimization/51040 PR rtl-optimization/51040
2011-11-10 Jakub Jelinek <jakub@redhat.com> 2011-11-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/51077
* gcc.c-torture/compile/pr51077.c: New test.
PR rtl-optimization/51023 PR rtl-optimization/51023
* gcc.c-torture/execute/pr51023.c: New test. * gcc.c-torture/execute/pr51023.c: New test.
......
/* PR middle-end/51077 */
struct S { unsigned char s, t[256]; };
void
foo (const struct S *x, struct S *y, int z)
{
int i;
for (i = 0; i < 8; i++)
{
const struct S *a = &x[i];
__builtin___memcpy_chk (y->t, a->t, z, __builtin_object_size (y->t, 0));
y = (struct S *) &y->t[z];
}
}
...@@ -175,7 +175,7 @@ addr_object_size (struct object_size_info *osi, const_tree ptr, ...@@ -175,7 +175,7 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
unsigned HOST_WIDE_INT sz; unsigned HOST_WIDE_INT sz;
if (!osi || (object_size_type & 1) != 0 if (!osi || (object_size_type & 1) != 0
|| TREE_CODE (pt_var) != SSA_NAME) || TREE_CODE (TREE_OPERAND (pt_var, 0)) != SSA_NAME)
{ {
sz = compute_builtin_object_size (TREE_OPERAND (pt_var, 0), sz = compute_builtin_object_size (TREE_OPERAND (pt_var, 0),
object_size_type & ~1); object_size_type & ~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