https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121000

--- Comment #3 from qinzhao at gcc dot gnu.org ---
(In reply to Richard Biener from comment #2)
> > we can cleanly see that _26 is an uninitialized variable, whose
> > initialization has been eliminated by the previous optimization already due
> > to it's not used in IL at all. 
> 
> You indeed cannot use (non-constant) TYPE_SIZE_UNIT in this way.  If there
> is an ARRAY_REF in the IL you can use array_ref_element_size to get at it.
> But arbitrary VLA type sizes to not survive unless you use them in the
> original GENERIC IL.

yeah, that's the major issue. 
So, passing the original TYPE_SIZE_UNIT to the call to .ACCESS_WITH_SIZE as one
argument should add one explicit usage of the TYPE_SIZE_UNIT in the original
IL, and the definition of the TYPE_SIZE_UNIT will survive the compiler
optimization till the object size phase. 
is there any other issue with this solution?

Reply via email to