OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr45070.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* PR45070 */
2
extern void abort(void);
3
 
4
struct packed_ushort {
5
    unsigned short ucs;
6
} __attribute__((packed));
7
 
8
struct source {
9
    int pos, length;
10
    int flag;
11
};
12
 
13
static void __attribute__((noinline)) fetch(struct source *p)
14
{
15
    p->length = 128;
16
}
17
 
18
static struct packed_ushort __attribute__((noinline)) next(struct source *p)
19
{
20
    struct packed_ushort rv;
21
 
22
    if (p->pos >= p->length) {
23
        if (p->flag) {
24
            p->flag = 0;
25
            fetch(p);
26
            return next(p);
27
        }
28
        p->flag = 1;
29
        rv.ucs = 0xffff;
30
        return rv;
31
    }
32
    rv.ucs = 0;
33
    return rv;
34
}
35
 
36
int main(void)
37
{
38
    struct source s;
39
    int i;
40
 
41
    s.pos = 0;
42
    s.length = 0;
43
    s.flag = 0;
44
 
45
    for (i = 0; i < 16; i++) {
46
        struct packed_ushort rv = next(&s);
47
        if ((i == 0 && rv.ucs != 0xffff)
48
            || (i > 0 && rv.ucs != 0))
49
            abort();
50
    }
51
    return 0;
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.