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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [torture/] [pr34850.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2" } */
3
 
4
typedef unsigned char uint8_t;
5
typedef unsigned int uint32_t;
6
typedef uint8_t byte;
7
typedef uint32_t u32bit;
8
__extension__ typedef __SIZE_TYPE__ size_t;
9
extern "C" {
10
    extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("")));
11
    extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
12
    void * memset (void *__dest, int __ch, size_t __len) throw () {
13
        if (__builtin_constant_p (__len) && __len == 0)
14
            __warn_memset_zero_len (); /* { dg-warning "" } */
15
    }
16
}
17
inline void clear_mem(void* ptr, u32bit n)    {
18
    memset(ptr, 0, n);
19
}
20
template class MemoryRegion    {
21
public:
22
    u32bit size() const {
23
    }
24
    const T* begin() const {
25
    }
26
    void set(const T in[], u32bit n) {
27
        create(n);
28
    }
29
    void set(const MemoryRegion& in) {
30
        set(in.begin(), in.size());
31
    }
32
    void clear() {
33
        clear_mem(buf, allocated);
34
    }
35
    void create(u32bit);
36
    MemoryRegion() {
37
        used = allocated = 0;
38
    }
39
    mutable T* buf;
40
    mutable u32bit used;
41
    mutable u32bit allocated;
42
};
43
template void MemoryRegion::create(u32bit n)    {
44
    if(n <= allocated) {
45
        clear();
46
    }
47
}
48
template class SecureVector : public MemoryRegion    {
49
public:
50
    SecureVector& operator=(const MemoryRegion& in)          {
51
        if(this != &in) set(in);
52
    }
53
};
54
class OctetString    {
55
public:
56
    SecureVector bits_of() const {
57
    }
58
    OctetString& operator^=(const OctetString&);
59
    void change(const MemoryRegion& in) {
60
        bits = in;
61
    }
62
    OctetString(const MemoryRegion& in) {
63
        change(in);
64
    }
65
    SecureVector bits;
66
};
67
OctetString& OctetString::operator^=(const OctetString& k)    {
68
    if(&k == this) {
69
        bits.clear();
70
    }
71
}
72
bool operator==(const OctetString& s1, const OctetString& s2)    {
73
    return (s1.bits_of() == s2.bits_of());
74
}

powered by: WebSVN 2.1.0

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