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