1  /* PR tree-optimization/50569 */
       2  /* Reported by Paul Koning <pkoning@gcc.gnu.org> */
       3  /* Reduced testcase by Mikael Pettersson <mikpe@it.uu.se> */
       4  
       5  struct event {
       6      struct {
       7  	unsigned int sec;
       8      } sent __attribute__((packed));
       9  };
      10  
      11  void __attribute__((noinline,noclone)) frob_entry(char *buf)
      12  {
      13      struct event event;
      14  
      15      __builtin_memcpy(&event, buf, sizeof(event));
      16      if (event.sent.sec < 64) {
      17  	event.sent.sec = -1U;
      18  	__builtin_memcpy(buf, &event, sizeof(event));
      19      }
      20  }
      21  
      22  int main(void)
      23  {
      24      union {
      25  	char buf[1 + sizeof(struct event)];
      26  	int align;
      27      } u;
      28  
      29      __builtin_memset(&u, 0, sizeof u);
      30  
      31      frob_entry(&u.buf[1]);
      32  
      33      return 0;
      34  }