https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111262

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Reduced C++ code is

struct _Rb_tree_header {
  int _M_node_count;
};
struct _Rb_tree {
  _Rb_tree_header _M_impl;
  bool empty() { return _M_impl._M_node_count; }
};
struct Trans_NS_std_map {
  _Rb_tree _M_t;
  int empty() { return _M_t.empty(); }
};
struct SmallBlock {
  static long BLOCK_SIZE;
};
long BytesOnBlock_blocks, CmpDifferentBytes_total;
int TestFirstByte_rand;
struct Regtest {
  struct FileSpec {
    FileSpec(int *);
    int Blocks_blksize;
    long Blocks() {
      if (table_.empty())
        return 0;
      return Blocks_blksize;
    }
    Trans_NS_std_map table_;
  };
  struct BlockIterator {
    BlockIterator(FileSpec spec)
        : spec_(spec), blksize_(SmallBlock::BLOCK_SIZE) {}
    bool Done() { return blkno_ >= spec_.Blocks(); }
    void Next() { blkno_++; }
    int BytesOnBlock() {
      if (blkno_ == BytesOnBlock_blocks)
        return 1;
      return blksize_;
    }
    FileSpec spec_;
    unsigned long blkno_;
    int blksize_;
  };
  void CmpDifferentBlockBytes();
  void CmpDifferentBytes(FileSpec a) {
    BlockIterator a_i(a);
    CmpDifferentBlockBytes();
    for (; !a_i.Done(); a_i.Next())
      CmpDifferentBytes_total += a_i.BytesOnBlock();
  }
  void TestFirstByte() {
    FileSpec spec0(&TestFirstByte_rand);
    CmpDifferentBytes(spec0);
  }
};
main() {
  Regtest regtest;
  regtest.TestFirstByte();
}

Reply via email to