diff options
author | Siddhesh Poyarekar <siddhesh@gotplt.org> | 2022-03-23 23:09:02 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@gotplt.org> | 2022-03-24 15:04:31 +0530 |
commit | c1d233e3334df07cfb4f732ace4d93d3cbc28bca (patch) | |
tree | 6d2c3aaf2ed389628746e5f07109011c32cbc1ba /gcc/fold-const.cc | |
parent | 72124f487ccb5c8065dd5f7b8fba254600b7e611 (diff) | |
download | gcc-c1d233e3334df07cfb4f732ace4d93d3cbc28bca.zip gcc-c1d233e3334df07cfb4f732ace4d93d3cbc28bca.tar.gz gcc-c1d233e3334df07cfb4f732ace4d93d3cbc28bca.tar.bz2 |
tree-optimization/104970: Limit size computation for access attribute
Limit object size computation only to the simple case where access
attribute has been explicitly specified. The object passed to
__builtin_dynamic_object_size could either be a pointer or a VLA whose
size has been described using access attribute.
Further, return a valid size only if the object is a void * pointer or
points to (or is a VLA of) a type that has a constant size.
gcc/ChangeLog:
PR tree-optimization/104970
* tree-object-size.cc (parm_object_size): Restrict size
computation scenarios to explicit access attributes.
gcc/testsuite/ChangeLog:
PR tree-optimization/104970
* gcc.dg/builtin-dynamic-object-size-0.c (test_parmsz_simple2,
test_parmsz_simple3, test_parmsz_extern, test_parmsz_internal,
test_parmsz_internal2, test_parmsz_internal3): New tests.
(main): Use them.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Diffstat (limited to 'gcc/fold-const.cc')
0 files changed, 0 insertions, 0 deletions