modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.c (about)

     1  /* { dg-require-effective-target int32plus } */
     2  struct big
     3  {
     4    int data[1000000];
     5  };
     6  
     7  struct small
     8  {
     9    int data[10];
    10  };
    11  
    12  union both
    13  {
    14    struct big big;
    15    struct small small;
    16  };
    17  
    18  extern void *calloc (__SIZE_TYPE__, __SIZE_TYPE__);
    19  extern void free (void *);
    20  
    21  static int __attribute__((noinline))
    22  foo (int fail, union both *agg)
    23  {
    24    int r;
    25    if (fail)
    26      r = agg->big.data[999999];
    27    else
    28      r = agg->small.data[0];
    29    return r;
    30  }
    31  
    32  int main (int argc, char *argv[])
    33  {
    34    union both *agg = calloc (1, sizeof (struct small));
    35    int r;
    36  
    37    r = foo ((argc > 2000), agg);
    38  
    39    free (agg);
    40    return r;
    41  }