https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117912
--- Comment #16 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #15)
> (In reply to Jakub Jelinek from comment #14)
> > struct S { int a; int b[24]; int c[24]; int d; };
> > void bar (int *);
> >
> > __SIZE_TYPE__
> > foo (struct S *p)
> > {
> > bar (&p->b[24]);
> > bar (&p->c[0]);
> > return __builtin_object_size (&p->c[0], 1);
> > }
Couldn't VN/CSE, when eliminating an expression involving pointers to
component_refs, pick the one that points to the beginning of a component rather
than the end? That should solve both these problems.