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

--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a simplified example without memcpy but an union instead of scalars
rather than vectors since vectors still run into PR 107916:
```
struct s1
{
  int t;
};

union s2
{
  long long tt;
  struct s1 t[2];
};

inline long long s1_to_s2(struct s1 a)
{
  s2 t={};
  t.t[0] = a;
  return t.tt;
}

inline 
long long insert_s1_to_s2 (long long c1, struct s1 b, int a)
{
  s2 c;
  c.tt = c1;
  c.t[a] = b;
  return c.tt;
}


void foo(long long& v, unsigned int n) {
  s1 f0 = {1};
  s1 f1 = {2};
  for (int i = 0; i < n; i++) {
    f0.t = f0.t + f0.t;
    f1.t = f1.t + f1.t;
    v = s1_to_s2(f0);
    v = insert_s1_to_s2(v, f1, 1);
  }
}
```

Reply via email to