1  /* { dg-do run } */
       2  /* { dg-options "-O2" } */
       3  
       4  #include <stdlib.h>
       5  
       6  struct wrapper_t
       7  {
       8    long k;
       9    long e;
      10  };
      11  
      12  struct wrapper_t **table;
      13  
      14  __attribute__ ((weak, regparm (2)))
      15  void
      16  update (long k, long e)
      17  {
      18    struct wrapper_t *elmt;
      19  
      20    elmt = table[k % 3079];
      21    if (elmt == 0)
      22      return;
      23    elmt->e = e;
      24  }
      25  
      26  int
      27  main ()
      28  {
      29    table = (struct wrapper_t **) malloc (20 * sizeof (struct wrapper_t *));
      30    for (int i = 0; i < 20; i++)
      31      table[i] = (struct wrapper_t *) calloc (sizeof (struct wrapper_t), 1);
      32    if (table[10]->e != 0)
      33      abort ();
      34    update (10, 20);
      35    if (table[10]->e != 20)
      36      abort ();
      37    return 0;
      38  }