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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> Better one:
> struct b { int data[16]; };
> 
> int foo (struct b *x)
> {
>   int *a = x->data;
>   int *b = ((int*)x) + 4;
>   return b - a;
> }

Note we can handle address of a variable case already; that is:
```
struct b { int data[16]; };

int foo (struct b x)
{
  int *a = x.data;
  int *b = ((int*)&x) + 4;
  return b - a;
}
```
is optimized during ccp1.

Reply via email to