Skip to content

Commit bed3415

Browse files
committed
Revert "Use the counted_by attribute of pointers in builtinin-object-size." due to PR120929
This reverts commit 7165ca4.
1 parent c307085 commit bed3415

9 files changed

+3
-269
lines changed

gcc/testsuite/gcc.dg/pointer-counted-by-4-char.c

Lines changed: 0 additions & 6 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-4-float.c

Lines changed: 0 additions & 6 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-4-struct.c

Lines changed: 0 additions & 10 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-4-union.c

Lines changed: 0 additions & 10 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-4.c

Lines changed: 0 additions & 77 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-5.c

Lines changed: 0 additions & 56 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-6.c

Lines changed: 0 additions & 56 deletions
This file was deleted.

gcc/testsuite/gcc.dg/pointer-counted-by-7.c

Lines changed: 0 additions & 32 deletions
This file was deleted.

gcc/tree-object-size.cc

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -861,12 +861,10 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
861861
4th argument TYPE_OF_SIZE: A constant 0 with its TYPE being the same as the TYPE
862862
of the object referenced by REF_TO_SIZE
863863
6th argument: A constant 0 with the pointer TYPE to the original flexible
864-
array type or pointer field type.
864+
array type.
865865
866866
The size of the element can be retrived from the TYPE of the 6th argument
867-
of the call, which is the pointer to the original flexible array type or
868-
the type of the original pointer field. */
869-
867+
of the call, which is the pointer to the array type. */
870868
static tree
871869
access_with_size_object_size (const gcall *call, int object_size_type)
872870
{
@@ -876,7 +874,7 @@ access_with_size_object_size (const gcall *call, int object_size_type)
876874

877875
gcc_assert (gimple_call_internal_p (call, IFN_ACCESS_WITH_SIZE));
878876
/* The type of the 6th argument type is the pointer TYPE to the original
879-
flexible array type or to the original pointer type. */
877+
flexible array type. */
880878
tree pointer_to_array_type = TREE_TYPE (gimple_call_arg (call, 5));
881879
gcc_assert (POINTER_TYPE_P (pointer_to_array_type));
882880
tree element_type = TREE_TYPE (TREE_TYPE (pointer_to_array_type));
@@ -1944,17 +1942,6 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
19441942
if (TREE_CODE (rhs) == SSA_NAME
19451943
&& POINTER_TYPE_P (TREE_TYPE (rhs)))
19461944
reexamine = merge_object_sizes (osi, var, rhs);
1947-
/* Handle the following stmt #2 to propagate the size from the
1948-
stmt #1 to #3:
1949-
1 _1 = .ACCESS_WITH_SIZE (_3, _4, 1, 0, -1, 0B);
1950-
2 _5 = *_1;
1951-
3 _6 = __builtin_dynamic_object_size (_5, 1);
1952-
*/
1953-
else if (TREE_CODE (rhs) == MEM_REF
1954-
&& POINTER_TYPE_P (TREE_TYPE (rhs))
1955-
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
1956-
&& integer_zerop (TREE_OPERAND (rhs, 1)))
1957-
reexamine = merge_object_sizes (osi, var, TREE_OPERAND (rhs, 0));
19581945
else
19591946
expr_object_size (osi, var, rhs);
19601947
}

0 commit comments

Comments
 (0)