(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
packed-array.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -fno-inline" } */
       3  
       4  struct usb_interface_descriptor {
       5   unsigned short wMaxPacketSize;
       6    char e;
       7  } __attribute__ ((packed));
       8  
       9  struct usb_device {
      10   int devnum;
      11   struct usb_interface_descriptor if_desc[2];
      12  };
      13  
      14  extern int printf (const char *, ...);
      15  
      16  void foo (unsigned short a)
      17  {
      18    printf ("%d\n", a);
      19  }
      20  
      21  struct usb_device ndev;
      22  
      23  void usb_set_maxpacket(int n)
      24  {
      25    int i;
      26  
      27    for(i=0; i<n;i++)
      28      foo((&ndev)->if_desc[i].wMaxPacketSize);
      29  }
      30  
      31  int
      32  main()
      33  {
      34    usb_set_maxpacket(2);
      35    return 0;
      36  }
      37  
      38  
      39  
      40