On Thu, Mar 24, 2022 at 08:39:44AM +0530, Siddhesh Poyarekar wrote: > 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 only 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 <siddh...@gotplt.org>
Ok, thanks. Jakub