(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
ssa-ccp-15.c
       1  /* { dg-do compile } */ 
       2  /* { dg-options "-O2 -fdump-tree-optimized" } */
       3  
       4  /* Check that the initial values are honored when necessary.  */
       5  
       6  void link_error (void);
       7  
       8  /* The call to link_error cannot be eliminated in this case.  */
       9  
      10  void test1 (int param1, int param2, int x)
      11  {
      12    if (param1)
      13      x = 3;
      14  
      15    if (param2)
      16      if (x != 3)
      17        link_error ();
      18  }
      19  
      20  /* The call to link_error cannot be eliminated in this case.  */
      21  
      22  int global;
      23  void test2 (int param1, int param2)
      24  {
      25    if (param1)
      26      global = 3;
      27  
      28    if (param2)
      29      if (global != 3)
      30        link_error ();
      31  }
      32  
      33  /* In this case, we can eliminate the call, as unless "local" is set
      34     to 3, its value is undefined.  */
      35  
      36  void test3 (int param1, int param2)
      37  {
      38    int local;
      39  
      40    if (param1)
      41      local = 3;
      42  
      43    if (param2)
      44      if (local != 3)
      45        link_error ();
      46  }
      47  
      48  /* { dg-final { scan-tree-dump-times "link_error" 2 "optimized" } } */