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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20071120-1.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
extern void abort (void);
2
 
3
void __attribute__((noinline,noreturn))
4
vec_assert_fail (void)
5
{
6
    abort ();
7
}
8
 
9
struct ggc_root_tab {
10
    void *base;
11
};
12
 
13
typedef struct deferred_access_check {} VEC_deferred_access_check_gc;
14
 
15
typedef struct deferred_access {
16
    VEC_deferred_access_check_gc* deferred_access_checks;
17
    int deferring_access_checks_kind;
18
} deferred_access;
19
 
20
typedef struct VEC_deferred_access_base {
21
    unsigned num;
22
    deferred_access vec[1];
23
} VEC_deferred_access_base;
24
 
25
static __inline__ deferred_access *
26
VEC_deferred_access_base_last (VEC_deferred_access_base *vec_)
27
{
28
    (void)((vec_ && vec_->num) ? 0 : (vec_assert_fail (), 0));
29
    return &vec_->vec[vec_->num - 1];
30
}
31
 
32
static __inline__  void
33
VEC_deferred_access_base_pop (VEC_deferred_access_base *vec_)
34
{
35
    (void)((vec_->num) ? 0 : (vec_assert_fail (), 0));
36
    --vec_->num;
37
}
38
 
39
void __attribute__((noinline))
40
perform_access_checks (VEC_deferred_access_check_gc* p)
41
{
42
    abort ();
43
}
44
 
45
typedef struct VEC_deferred_access_gc {
46
    VEC_deferred_access_base base;
47
} VEC_deferred_access_gc;
48
 
49
static VEC_deferred_access_gc *deferred_access_stack;
50
static unsigned deferred_access_no_check;
51
 
52
const struct ggc_root_tab gt_pch_rs_gt_cp_semantics_h[] = {
53
    {
54
        &deferred_access_no_check
55
    }
56
};
57
 
58
void __attribute__((noinline)) pop_to_parent_deferring_access_checks (void)
59
{
60
    if (deferred_access_no_check)
61
        deferred_access_no_check--;
62
    else
63
    {
64
        VEC_deferred_access_check_gc *checks;
65
        deferred_access *ptr;
66
        checks = (VEC_deferred_access_base_last(deferred_access_stack ? &deferred_access_stack->base : 0))->deferred_access_checks;
67
        VEC_deferred_access_base_pop(deferred_access_stack ? &deferred_access_stack->base : 0);
68
        ptr = VEC_deferred_access_base_last(deferred_access_stack ? &deferred_access_stack->base : 0);
69
        if (ptr->deferring_access_checks_kind == 0)
70
            perform_access_checks (checks);
71
    }
72
}
73
 
74
int main()
75
{
76
    deferred_access_stack = __builtin_malloc (sizeof(VEC_deferred_access_gc) + sizeof(deferred_access) * 8);
77
    deferred_access_stack->base.num = 2;
78
    deferred_access_stack->base.vec[0].deferring_access_checks_kind = 1;
79
    pop_to_parent_deferring_access_checks ();
80
    return 0;
81
}

powered by: WebSVN 2.1.0

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