* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr33669.c
blob69d86258d21cc27d87224c472ace54c0588d24af
1 extern void abort (void);
3 typedef struct foo_t
4 {
5 unsigned int blksz;
6 unsigned int bf_cnt;
7 } foo_t;
9 #define _RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) * (unit))
10 #define _RNDDOWN(x, unit) ((x) - ((x)%(unit)))
12 long long
13 foo (foo_t *const pxp, long long offset, unsigned int extent)
15 long long blkoffset = _RNDDOWN(offset, (long long )pxp->blksz);
16 unsigned int diff = (unsigned int)(offset - blkoffset);
17 unsigned int blkextent = _RNDUP(diff + extent, pxp->blksz);
19 if (pxp->blksz < blkextent)
20 return -1LL;
22 if (pxp->bf_cnt > pxp->blksz)
23 pxp->bf_cnt = pxp->blksz;
25 return blkoffset;
28 int
29 main ()
31 foo_t x;
32 long long xx;
34 x.blksz = 8192;
35 x.bf_cnt = 0;
36 xx = foo (&x, 0, 4096);
37 if (xx != 0LL)
38 abort ();
39 return 0;