Re: [PATCH] tree-optimization/120780: Support object size for containing objects

2025-06-27 Thread Siddhesh Poyarekar
On 2025-06-27 08:05, Jakub Jelinek wrote: On Fri, Jun 27, 2025 at 02:00:26PM +0200, Richard Biener wrote: + gcc_assert (RECORD_OR_UNION_TYPE_P (container)); + + for (tree t = TYPE_FIELDS (container); t; t = DECL_CHAIN (t)) +{ + if (TREE_CODE (t) != FIELD_DECL) +continue; + +

Re: [PATCH] tree-optimization/120780: Support object size for containing objects

2025-06-27 Thread Jakub Jelinek
On Fri, Jun 27, 2025 at 02:00:26PM +0200, Richard Biener wrote: > > + gcc_assert (RECORD_OR_UNION_TYPE_P (container)); > > + > > + for (tree t = TYPE_FIELDS (container); t; t = DECL_CHAIN (t)) > > +{ > > + if (TREE_CODE (t) != FIELD_DECL) > > +continue; > > + > > + tree byte_off

Re: [PATCH] tree-optimization/120780: Support object size for containing objects

2025-06-27 Thread Richard Biener
> Am 27.06.2025 um 13:40 schrieb Siddhesh Poyarekar : > > MEM_REF cast of a subobject to its containing object has negative > offsets, which objsz sees as an invalid access. Support this use case > by peeking into the structure to validate that the containing object > indeed contains a type o

Re: [PATCH] tree-optimization/120780: Support object size for containing objects

2025-06-27 Thread Siddhesh Poyarekar
On 2025-06-27 07:40, Siddhesh Poyarekar wrote: MEM_REF cast of a subobject to its containing object has negative offsets, which objsz sees as an invalid access. Support this use case by peeking into the structure to validate that the containing object indeed contains a type of the subobject at t

[PATCH] tree-optimization/120780: Support object size for containing objects

2025-06-27 Thread Siddhesh Poyarekar
MEM_REF cast of a subobject to its containing object has negative offsets, which objsz sees as an invalid access. Support this use case by peeking into the structure to validate that the containing object indeed contains a type of the subobject at that offset and if present, adjust the wholesize f