(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr48335-1.c
       1  /* PR middle-end/48335 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -fno-tree-sra" } */
       4  
       5  typedef long long T __attribute__((may_alias));
       6  
       7  struct S
       8  {
       9    _Complex float d __attribute__((aligned (8)));
      10  };
      11  
      12  void bar (struct S);
      13  
      14  void
      15  f1 (T x)
      16  {
      17    struct S s;
      18    *(T *) &s.d = x;
      19    __real__ s.d *= 7.0;
      20    bar (s);
      21  }
      22  
      23  void
      24  f2 (int x)
      25  {
      26    struct S s = { .d = 0.0f };
      27    *(char *) &s.d = x;
      28    __real__ s.d *= 7.0;
      29    bar (s);
      30  }
      31  
      32  void
      33  f3 (int x)
      34  {
      35    struct S s = { .d = 0.0f };
      36    ((char *) &s.d)[2] = x;
      37    __real__ s.d *= 7.0;
      38    bar (s);
      39  }
      40  
      41  void
      42  f4 (int x, int y)
      43  {
      44    struct S s = { .d = 0.0f };
      45    ((char *) &s.d)[y] = x;
      46    __real__ s.d *= 7.0;
      47    bar (s);
      48  }