* gcc.c-torture/execute/20101011-1.c: Skip on SH.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20001124-1.c
blobc0ec8cf0446dc73d3eed16e6a08cc38efadfd28f
2 struct inode {
3 long long i_size;
4 struct super_block *i_sb;
5 };
7 struct file {
8 long long f_pos;
9 };
11 struct super_block {
12 int s_blocksize;
13 unsigned char s_blocksize_bits;
14 int s_hs;
17 static char *
18 isofs_bread(unsigned int block)
20 if (block)
21 abort ();
22 exit(0);
25 static int
26 do_isofs_readdir(struct inode *inode, struct file *filp)
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;
34 if (filp->f_pos >= inode->i_size)
35 return 0;
37 offset = filp->f_pos & (bufsize - 1);
38 block = filp->f_pos >> bufbits;
39 hs = inode->i_sb->s_hs;
41 while (filp->f_pos < inode->i_size) {
42 if (!bh)
43 bh = isofs_bread(block);
45 hs += block << bufbits;
47 if (hs == 0)
48 filp->f_pos++;
50 if (offset >= bufsize)
51 offset &= bufsize - 1;
53 if (*bh)
54 filp->f_pos++;
56 filp->f_pos++;
58 return 0;
61 struct super_block s;
62 struct inode i;
63 struct file f;
65 int
66 main(int argc, char **argv)
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;
74 do_isofs_readdir(&i,&f);
75 abort ();