[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr61009.C
blobe07d29c0ad75ecd1563f6843cc611336bc425b5c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-vrp -std=c++11 -fno-strict-aliasing -fdump-tree-dom2" } */
4 #include <stdio.h>
5 struct Field {
6  virtual int Compare(void*, void*);
7 };
8 extern int NKF, NR;
9 extern int idxs[];
10 extern Field* the_field;
11 extern int *incs;
12 extern char** fptrs;
13 inline int doCmp(int this_row_offset, int field_idx) {
14  void *p = fptrs[field_idx] + this_row_offset * incs[field_idx];
15  return the_field->Compare(p,0);
17 bool  Test(void) {
19  int row_offset = 0;
21  for (; row_offset < NR; ++row_offset) {
23    bool is_different = false;
24    for (int j = 0; j < NKF ; ++j) {
25      int field_idx = idxs[j];
26      int cmp = doCmp(row_offset, field_idx);
27      fprintf (stderr, "cmp=%d\n",cmp);
29      if (cmp == 0) {
30        continue;
31      }
32      if (cmp > 0) {
33        is_different = true;
34        break;
35      } else {
36        fprintf (stderr, "Incorrect\n");
37        return false;
38      }
39    }
40    if (!is_different) {
42      return false;
43    }
44  }
46  return true;
49 // The block ending with cmp == 0 should not be threaded.  ie,
50 // there should be a single == 0 comparison in the dump file.
52 // { dg-final { scan-tree-dump-times "== 0" 1 "dom2" } }