tree-optimization/104941: Actually assign the conversion result
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Wed, 16 Mar 2022 15:15:47 +0000 (20:45 +0530)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Wed, 16 Mar 2022 15:15:48 +0000 (20:45 +0530)
commitbeb12c62eaec37ed0ee5a251ca0907d965d413b2
treed320f700bbc0113c4cbf9ef9ea3d20153f3a0ab2
parentbe093b8dcc9cf5c9f99479ec68f1abe95aa38a83
tree-optimization/104941: Actually assign the conversion result

Assign the result of fold_convert to offset.  Also make the useless
conversion check lighter since the two way check is not needed here.

gcc/ChangeLog:

PR tree-optimization/104941
* tree-object-size.cc (size_for_offset): Make useless conversion
check lighter and assign result of fold_convert to OFFSET.

gcc/testsuite/ChangeLog:

PR tree-optimization/104941
* gcc.dg/builtin-dynamic-object-size-0.c (S1, S2): New structs.
(test_alloc_nested_structs, g): New functions.
(main): Call test_alloc_nested_structs.

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