(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
20001124-1.c
       1  
       2  struct inode {
       3  	long long		i_size;
       4  	struct super_block	*i_sb;
       5  };
       6  
       7  struct file {
       8  	long long		f_pos;
       9  };
      10  
      11  struct super_block {
      12  	int			s_blocksize;
      13  	unsigned char		s_blocksize_bits;
      14  	int			s_hs;
      15  };
      16  
      17  static char *
      18  isofs_bread(unsigned int block)
      19  {
      20  	if (block)
      21  	  abort ();
      22  	exit(0);
      23  }
      24  
      25  static int
      26  do_isofs_readdir(struct inode *inode, struct file *filp)
      27  {
      28  	int bufsize = inode->i_sb->s_blocksize;
      29  	unsigned char bufbits = inode->i_sb->s_blocksize_bits;
      30  	unsigned int block, offset;
      31  	char *bh = 0;
      32  	int hs;
      33  
      34   	if (filp->f_pos >= inode->i_size)
      35  		return 0;
      36   
      37  	offset = filp->f_pos & (bufsize - 1);
      38  	block = filp->f_pos >> bufbits;
      39  	hs = inode->i_sb->s_hs;
      40  
      41  	while (filp->f_pos < inode->i_size) {
      42  		if (!bh)
      43  			bh = isofs_bread(block);
      44  
      45  		hs += block << bufbits;
      46  
      47  		if (hs == 0)
      48  			filp->f_pos++;
      49  
      50  		if (offset >= bufsize)
      51  			offset &= bufsize - 1;
      52  
      53  		if (*bh)
      54  			filp->f_pos++;
      55  
      56  		filp->f_pos++;
      57  	}
      58  	return 0;
      59  }
      60  
      61  struct super_block s;
      62  struct inode i;
      63  struct file f;
      64  
      65  int
      66  main(int argc, char **argv)
      67  {
      68  	s.s_blocksize = 512;
      69  	s.s_blocksize_bits = 9;
      70  	i.i_size = 2048;
      71  	i.i_sb = &s;
      72  	f.f_pos = 0;
      73  
      74  	do_isofs_readdir(&i,&f);
      75  	abort ();
      76  }