On Mon, Jun 29, 2020 at 01:05:20PM +0200, Richard Biener via Gcc wrote: > > // source code > > struct astruct a; > > memset(a, 0, sizeof(a)); > > > > // parse time > > memset(a, 0, 64);
Actually, I don't see the point at all, it doesn't matter if the user used sizeof(a) or 64 knowing that the structure time is 64 bytes, or say constexpr/consteval that used somewhere the sizeof in some complex expression, or whatever else. One just shouldn't try to remove fields at all in these cases, similar to many other cases where it is not safely possible. Actually, you could for memset (a, 0, 64); remove any fields that can be removed and whose offsetof is >= 64, because such a call doesn't affect them. Jakub