tree-optimization/104942: Retain sizetype conversions till the end
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Wed, 16 Mar 2022 10:40:51 +0000 (16:10 +0530)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Wed, 16 Mar 2022 10:40:51 +0000 (16:10 +0530)
commit818e305ea692ebc6578fb40881887d45382f876b
tree6d0218fb04a76aa34bbd0e3d7505b68860eb177c
parent952155629ca1a4dfe7c7b26e53d118a9b853ed4a
tree-optimization/104942: Retain sizetype conversions till the end

Retain the sizetype alloc_object_size to guarantee the assertion in
size_for_offset and to avoid adding a conversion there.  nop conversions
are eliminated at the end anyway in dynamic object size computation.

gcc/ChangeLog:

PR tree-optimization/104942
* tree-object-size.cc (alloc_object_size): Remove STRIP_NOPS.

gcc/testsuite/ChangeLog:

PR tree-optimization/104942
* gcc.dg/builtin-dynamic-object-size-0.c (alloc_func_long,
test_builtin_malloc_long): New functions.
(main): Use it.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c
gcc/tree-object-size.cc