(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
misaligned-expand-3.c
       1  /* Test that expand can generate correct stores to misaligned data of complex
       2     type even on strict alignment platforms.  */
       3  
       4  /* { dg-do run } */
       5  /* { dg-options "-O0" } */
       6  
       7  extern void abort ();
       8  
       9  typedef _Complex float mycmplx __attribute__((aligned(1)));
      10  
      11  void
      12  foo (mycmplx *p, float r, float i)
      13  {
      14    __real__ *p = r;
      15    __imag__ *p = i;
      16  }
      17  
      18  #define cvr 3.2f
      19  #define cvi 2.5f
      20  #define NUM 8
      21  
      22  struct blah
      23  {
      24    char c;
      25    mycmplx x[NUM];
      26  } __attribute__((packed));
      27  
      28  struct blah g;
      29  
      30  int
      31  main (int argc, char **argv)
      32  {
      33    int k;
      34  
      35    for (k = 0; k < NUM; k++)
      36      {
      37        foo (&g.x[k], cvr, cvi);
      38        if (__real__ g.x[k] != cvr
      39  	  || __imag__ g.x[k] != cvi)
      40  	abort ();
      41      }
      42    return 0;
      43  }