(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
fold-compare-3.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fdump-tree-cfg" } */
       3  
       4  #include <limits.h>
       5  
       6  void this_comparison_is_false (void);
       7  void this_comparison_is_true (void);
       8  void this_comparison_is_not_decidable (void);
       9  
      10  void bla1eq (int var)
      11  {
      12    if (var + 10 == INT_MIN + 9)
      13      this_comparison_is_false ();
      14  }
      15  
      16  void bla2eq (int var)
      17  {
      18    if (var + 10 == INT_MIN + 10)
      19      this_comparison_is_not_decidable ();
      20  }
      21  
      22  void bla3eq (int var)
      23  {
      24    if (var - 10 == INT_MAX - 9)
      25      this_comparison_is_false ();
      26  }
      27  
      28  void bla4eq (int var)
      29  {
      30    if (var - 10 == INT_MAX - 10)
      31      this_comparison_is_not_decidable ();
      32  }
      33  
      34  void bla1ne (int var)
      35  {
      36    if (var + 10 != INT_MIN + 9)
      37      this_comparison_is_true ();
      38  }
      39  
      40  void bla2ne (int var)
      41  {
      42    if (var + 10 != INT_MIN + 10)
      43      this_comparison_is_not_decidable ();
      44  }
      45  
      46  void bla3ne (int var)
      47  {
      48    if (var - 10 != INT_MAX - 9)
      49      this_comparison_is_true ();
      50  }
      51  
      52  void bla4ne (int var)
      53  {
      54    if (var - 10 != INT_MAX - 10)
      55      this_comparison_is_not_decidable ();
      56  }
      57  
      58  void bla1lt (int var)
      59  {
      60    if (var + 10 < INT_MIN + 10)
      61      this_comparison_is_false ();
      62  }
      63  
      64  void bla2lt (int var)
      65  {
      66    if (var + 10 < INT_MIN + 11)
      67      this_comparison_is_not_decidable ();
      68  }
      69  
      70  void bla3lt (int var)
      71  {
      72    if (var - 10 < INT_MAX - 9)
      73      this_comparison_is_true ();
      74  }
      75  
      76  void bla4lt (int var)
      77  {
      78    if (var - 10 < INT_MAX - 10)
      79      this_comparison_is_not_decidable ();
      80  }
      81  
      82  void bla1le (int var)
      83  {
      84    if (var + 10 <= INT_MIN + 9)
      85      this_comparison_is_false ();
      86  }
      87  
      88  void bla2le (int var)
      89  {
      90    if (var + 10 <= INT_MIN + 10)
      91      this_comparison_is_not_decidable ();
      92  }
      93  
      94  void bla3le (int var)
      95  {
      96    if (var - 10 <= INT_MAX - 10)
      97      this_comparison_is_true ();
      98  }
      99  
     100  void bla4le (int var)
     101  {
     102    if (var - 10 <= INT_MAX - 11)
     103      this_comparison_is_not_decidable ();
     104  }
     105  
     106  void bla1gt (int var)
     107  {
     108    if (var + 10 > INT_MIN + 9)
     109      this_comparison_is_true ();
     110  }
     111  
     112  void bla2gt (int var)
     113  {
     114    if (var + 10 > INT_MIN + 10)
     115      this_comparison_is_not_decidable ();
     116  }
     117  
     118  void bla3gt (int var)
     119  {
     120    if (var - 10 > INT_MAX - 10)
     121      this_comparison_is_false ();
     122  }
     123  
     124  void bla4gt (int var)
     125  {
     126    if (var - 10 > INT_MAX - 11)
     127      this_comparison_is_not_decidable ();
     128  }
     129  
     130  void bla1ge (int var)
     131  {
     132    if (var + 10 >= INT_MIN + 10)
     133      this_comparison_is_true ();
     134  }
     135  
     136  void bla2ge (int var)
     137  {
     138    if (var + 10 >= INT_MIN + 11)
     139      this_comparison_is_not_decidable ();
     140  }
     141  
     142  void bla3ge (int var)
     143  {
     144    if (var - 11 >= INT_MAX - 10)
     145      this_comparison_is_false ();
     146  }
     147  
     148  void bla4ge (int var)
     149  {
     150    if (var - 10 >= INT_MAX - 10)
     151      this_comparison_is_not_decidable ();
     152  }
     153  
     154  /* { dg-final { scan-tree-dump-times "this_comparison_is_false" 0 "cfg" } } */
     155  /* { dg-final { scan-tree-dump-times "this_comparison_is_true" 6 "cfg" } } */
     156  /* { dg-final { scan-tree-dump-times "this_comparison_is_not_decidable" 12 "cfg" } } */
     157  /* { dg-final { scan-tree-dump-times "if " 12 "cfg" } } */
     158