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

     1  test_store_ccp (int i)
     2  {
     3    int *p, a, b, c;
     4  
     5    if (i < 5)
     6      p = &a;
     7    else if (i > 8)
     8      p = &b;
     9    else
    10      p = &c;
    11  
    12    *p = 10;
    13    b = 3;
    14  
    15    /* STORE-CCP was wrongfully propagating 10 into *p.  */
    16    return *p + 2;
    17  }
    18  
    19  
    20  test_store_copy_prop (int i)
    21  {
    22    int *p, a, b, c;
    23  
    24    if (i < 5)
    25      p = &a;
    26    else if (i > 8)
    27      p = &b;
    28    else
    29      p = &c;
    30  
    31    *p = i;
    32    b = i + 1;
    33  
    34    /* STORE-COPY-PROP was wrongfully propagating i into *p.  */
    35    return *p;
    36  }
    37  
    38  
    39  main()
    40  {
    41    int x;
    42    
    43    x = test_store_ccp (10);
    44    if (x == 12)
    45      abort ();
    46    
    47    x = test_store_copy_prop (9);
    48    if (x == 9)
    49      abort ();
    50  
    51    return 0;
    52  }