__builtin_dynamic_object_size: Recognize builtin
commit79a89108dd352cd9288f5de35481b1280c7588a5
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Fri, 17 Dec 2021 04:04:44 +0000 (17 09:34 +0530)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Fri, 17 Dec 2021 04:04:44 +0000 (17 09:34 +0530)
tree4aa9282ccfac93a496b2c43b67a4d508cbdc10e1
parent422f9eb7011b76c12ff00ffaee2bcc9cdddf16d5
__builtin_dynamic_object_size: Recognize builtin

Recognize the __builtin_dynamic_object_size builtin and add paths in the
object size path to deal with it, but treat it like
__builtin_object_size for now.  Also add tests to provide the same
testing coverage for the new builtin name.

gcc/ChangeLog:

* builtins.def (BUILT_IN_DYNAMIC_OBJECT_SIZE): New builtin.
* tree-object-size.h: Move object size type bits enum from
tree-object-size.c and add new value OST_DYNAMIC.
* builtins.c (expand_builtin, fold_builtin_2): Handle it.
(fold_builtin_object_size): Handle new builtin and adjust for
change to compute_builtin_object_size.
* tree-object-size.c: Include builtins.h.
(compute_builtin_object_size): Adjust.
(early_object_sizes_execute_one,
dynamic_object_sizes_execute_one): New functions.
(object_sizes_execute): Rename insert_min_max_p argument to
early.  Handle BUILT_IN_DYNAMIC_OBJECT_SIZE and call the new
functions.
* doc/extend.texi (__builtin_dynamic_object_size): Document new
builtin.

gcc/testsuite/ChangeLog:

* g++.dg/ext/builtin-dynamic-object-size1.C: New test.
* g++.dg/ext/builtin-dynamic-object-size2.C: Likewise.
* gcc.dg/builtin-dynamic-alloc-size.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-1.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-10.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-11.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-12.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-13.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-14.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-15.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-16.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-17.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-18.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-19.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-2.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-3.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-4.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-5.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-6.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-7.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-8.c: Likewise.
* gcc.dg/builtin-dynamic-object-size-9.c: Likewise.
* gcc.dg/builtin-object-size-16.c: Adjust to allow inclusion
from builtin-dynamic-object-size-16.c.
* gcc.dg/builtin-object-size-17.c: Likewise.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
29 files changed:
gcc/builtins.c
gcc/builtins.def
gcc/doc/extend.texi
gcc/testsuite/g++.dg/ext/builtin-dynamic-object-size1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/builtin-dynamic-object-size2.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-alloc-size.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-10.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-11.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-12.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-13.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-14.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-15.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-16.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-17.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-18.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-19.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-9.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-object-size-16.c
gcc/testsuite/gcc.dg/builtin-object-size-17.c
gcc/tree-object-size.c
gcc/tree-object-size.h