Index: examples/gc_no_raii/bug-repro/assert.c
===================================================================
--- examples/gc_no_raii/bug-repro/assert.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/assert.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,16 @@
+struct gc_object_header{
+ int size;
+};
+
+struct gc_state;
+
+inline _Bool needs_collect(gc_state* state) {
+ return state->used_space > 0;
+}
+
+struct gc_object_header* gc_get_object_for_ref();
+
+inline gc_object_header* gc_get_object_ptr(void* ptr)
+{
+ return 0;
+}
Index: examples/gc_no_raii/bug-repro/blockers/explicit_cast.c
===================================================================
--- examples/gc_no_raii/bug-repro/blockers/explicit_cast.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/blockers/explicit_cast.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,22 @@
+
+#include <stdbool.h>
+#include <stdint.h>
+
+struct gcpointer_t
+{
+	intptr_t ptr;
+	struct gcpointer_t* next;
+};
+
+forall(otype T)
+struct gcpointer
+{
+	gcpointer_t internal;
+};
+
+forall(otype T)
+static inline gcpointer(T) gcmalloc()
+{
+    gcpointer(T) test;
+    return test;
+}
Index: examples/gc_no_raii/bug-repro/blockers/file_scope.c
===================================================================
--- examples/gc_no_raii/bug-repro/blockers/file_scope.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/blockers/file_scope.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,18 @@
+
+#include <stdbool.h>
+#include <stdlib>
+
+#define POOL_SIZE_EXP 24
+#define POOL_SIZE_BYTES 0x1 << POOL_SIZE_EXP
+#define POOL_PTR_MASK ~(POOL_SIZE_BYTES - 1)
+
+#define CARDS_SIZE_EXP 12
+#define CARDS_SIZE_BYTES 0x1 << CARDS_SIZE_EXP
+#define CARDS_OFFSET_MASK (~(CARDS_SIZE_BYTES - 1)) & (POOL_SIZE_BYTES - 1)
+#define CARDS_COUNT POOL_SIZE_BYTES / CARDS_SIZE_BYTES
+
+struct card_table_t
+{
+	size_t count;
+	void* cards_start[CARDS_COUNT];
+};
Index: examples/gc_no_raii/bug-repro/blockers/recursive_realloc.c
===================================================================
--- examples/gc_no_raii/bug-repro/blockers/recursive_realloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/blockers/recursive_realloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,21 @@
+
+#include <stdbool.h>
+#include <stdlib>
+
+trait allocator_c(otype T, otype allocator_t)
+{
+	void realloc(allocator_t* const, size_t);
+};
+
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+inline void realloc(heap_allocator(T) *const this, size_t size)
+{
+	this->storage = (T*)realloc((void*)this->storage, this->capacity);
+}
Index: examples/gc_no_raii/bug-repro/crash.c
===================================================================
--- examples/gc_no_raii/bug-repro/crash.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/crash.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,6 @@
+
+void f()
+{
+ void* obj;
+ (void)obj;
+}
Index: examples/gc_no_raii/bug-repro/deref.c
===================================================================
--- examples/gc_no_raii/bug-repro/deref.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/deref.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,19 @@
+    forall(otype T)
+    struct wrap
+    {
+        T val;
+    };
+
+    forall(otype T)
+    T *? (wrap(T) rhs)
+    {
+        return rhs.val;
+    }
+
+    int main(int argc, char const *argv[])
+    {
+        wrap(int) test;
+        test.val = 3;
+        int i = *test;
+        return 0;
+    }
Index: examples/gc_no_raii/bug-repro/field.c
===================================================================
--- examples/gc_no_raii/bug-repro/field.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/field.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,130 @@
+extern "C" {
+#include <stdbool.h>
+#include <stdint.h>
+}
+
+#include <stdlib>
+
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t)
+{
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
+};
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+int global = 3;
+
+struct card_table_t
+{
+	size_t count;
+	void* cards_start[100];
+};
+
+static inline void ctor(card_table_t* const this)
+{
+	this->count = 0;
+}
+
+struct gc_memory_pool
+{
+	struct memory_pool* mirror;
+	struct memory_pool* next;
+
+	uint8_t type_code;
+
+	card_table_t* cards;
+
+	uint8_t* end_p;
+	uint8_t* free_p;
+	uint8_t start_p[1];
+};
+
+void ctor(	gc_memory_pool *const this,
+		size_t size,
+		gc_memory_pool* next,
+		gc_memory_pool* mirror,
+		uint8_t type
+	);
+
+void dtor(gc_memory_pool *const this);
+
+struct gc_pool_object_iterator
+{
+	struct gc_object_header* object;
+	#ifndef NDEBUG
+		intptr_t lower_limit;
+		intptr_t upper_limit;
+	#endif
+};
+
+void ctor(
+		gc_pool_object_iterator* const this,
+		void* start_object
+		#ifndef NDEBUG
+			, intptr_t pool_start
+			, intptr_t pool_end
+		#endif
+	);
+
+bool ?!=?(const gc_pool_object_iterator lhs, const gc_pool_object_iterator rhs);
+
+gc_pool_object_iterator begin(gc_memory_pool* const this);
+gc_pool_object_iterator end(gc_memory_pool* const);
+
+gc_pool_object_iterator* ++?(gc_pool_object_iterator* it);
+
+const void* *?(const gc_pool_object_iterator it);
+void* *?(gc_pool_object_iterator it);
+
+static inline bool gc_pool_is_from_space(const gc_memory_pool* pool)
+{
+	return false;
+}
+
+void gc_reset_pool(gc_memory_pool* const pool);
+
+static inline size_t gc_pool_size_used(const gc_memory_pool* pool)
+{
+	return pool->free_p - pool->start_p;
+}
+
+static inline size_t gc_pool_size_total(const gc_memory_pool* pool)
+{
+	return pool->end_p - pool->start_p;
+}
+
+static inline size_t gc_pool_size_left(const gc_memory_pool* pool)
+{
+	return pool->end_p - pool->free_p;
+}
+
+void* gc_pool_allocate(gc_memory_pool* const pool, size_t size, bool zero);
+
+gc_pool_object_iterator gc_pool_iterator_for(gc_memory_pool* const pool, void* member);
+
+void ctor(gc_memory_pool *const this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
+{
+	this->mirror = mirror;
+	this->next = next;
+	this->type_code = type;
+
+	this->cards = malloc();
+	ctor(this->cards);
+
+	this->end_p = ((uint8_t*)this) + size;
+	this->free_p = this->start_p;
+
+	// check(gc_pool_of(this) == this);
+	// check(this->cards);
+	// gc_reset_pool(this);
+}
Index: examples/gc_no_raii/bug-repro/find.c
===================================================================
--- examples/gc_no_raii/bug-repro/find.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/find.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,10 @@
+
+void main()
+{
+	int a[3] = {1, 2, 3};
+	int* begin = a;
+	int *const end = begin + 3;
+
+	int* f = find(begin, &end, 2);
+
+}
Index: examples/gc_no_raii/bug-repro/inline.c
===================================================================
--- examples/gc_no_raii/bug-repro/inline.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/inline.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,8 @@
+inline _Bool test(int t){
+	return t == 3;
+}
+
+int main()
+{
+	test(6);
+}
Index: examples/gc_no_raii/bug-repro/malloc.c
===================================================================
--- examples/gc_no_raii/bug-repro/malloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/malloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,33 @@
+forall(otype T)
+struct wrapper
+{
+    T val;
+};
+
+forall(otype T)
+void ctor(wrapper(T)* this)
+{
+    this->val = 0;
+}
+
+forall(otype T)
+wrapper(T) gcmalloc()
+{
+    wrapper(T) w;
+    ctor(&w);
+    return w;
+}
+
+forall(otype T)
+wrapper(T)* ?=? (wrapper(T)* lhs, wrapper(T)* rhs)
+{
+    lhs->val = rhs->val;
+    return lhs;
+}
+
+int main(int argc, char *argv[])
+{
+    wrapper(int) test;
+    test = gcmalloc();
+    return 0;
+}
Index: examples/gc_no_raii/bug-repro/not_equal.c
===================================================================
--- examples/gc_no_raii/bug-repro/not_equal.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/not_equal.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,10 @@
+
+struct pointer_t
+{
+	void* p;
+};
+
+_Bool operator_not_equal_p(pointer_t* lhs, pointer_t* rhs)
+{
+	return lhs->p == rhs->p;
+}
Index: examples/gc_no_raii/bug-repro/oddtype.c
===================================================================
--- examples/gc_no_raii/bug-repro/oddtype.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/oddtype.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,13 @@
+forall(dtype T)
+struct wrap {
+	int i;
+};
+
+forall(otype T) void ?{}(wrap(T)* this) {}
+forall(otype T) void ?=?(wrap(T)* this) {}
+forall(otype T) void ^?{}(wrap(T)* this) {}
+
+struct List_t {
+	int val;
+	wrap(List_t) next;
+};
Index: examples/gc_no_raii/bug-repro/push_back.c
===================================================================
--- examples/gc_no_raii/bug-repro/push_back.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/push_back.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,16 @@
+#include <stddef.h>
+#include <stdint.h>
+
+#include "push_back.h"
+
+typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t;
+
+void test()
+{
+	worklist_t w;
+	if(!empty(&w))
+	{
+		intptr_t zero = 0;
+		push_back(&w, &zero);
+	}
+}
Index: examples/gc_no_raii/bug-repro/push_back.h
===================================================================
--- examples/gc_no_raii/bug-repro/push_back.h	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/push_back.h	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t) {
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
+};
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+//------------------------------------------------------------------------------
+//Initialization
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void vector_ctor(vector(T, allocator_t) *const this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void dtor(vector(T, allocator_t) *const this);
+
+//------------------------------------------------------------------------------
+//Allocator
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+void ctor(heap_allocator(T) *const this);
+
+forall(otype T)
+void dtor(heap_allocator(T) *const this);
+
+forall(otype T)
+void realloc(heap_allocator(T) *const this, size_t size);
+
+forall(otype T)
+inline T* data(heap_allocator(T) *const this)
+{
+	return this->storage;
+}
+
+//------------------------------------------------------------------------------
+//Capacity
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline bool empty(vector(T, allocator_t) *const this)
+{
+	return this->size == 0;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline bool size(vector(T, allocator_t) *const this)
+{
+	return this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline void reserve(vector(T, allocator_t) *const this, size_t size)
+{
+	realloc(&this->storage, this->size+1);
+}
+
+//------------------------------------------------------------------------------
+//Modifiers
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void push_back(vector(T, allocator_t) *const this, T value);
Index: examples/gc_no_raii/bug-repro/realloc.c
===================================================================
--- examples/gc_no_raii/bug-repro/realloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/realloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,13 @@
+void* realloc(void*, unsigned long int);
+
+forall(otype T)
+struct wrap
+{
+	T* val;
+};
+
+forall(otype T)
+static inline void realloc(wrap(T) *const this, unsigned long int size)
+{
+	this->val = (T*)realloc((void*)this->val, size);
+}
Index: examples/gc_no_raii/bug-repro/return.c
===================================================================
--- examples/gc_no_raii/bug-repro/return.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/return.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,27 @@
+forall(otype T)
+struct wrapper
+{
+	T value;
+};
+
+forall(otype T)
+wrapper(T) create()
+{
+	wrapper(T) test;
+	return test;
+}
+
+forall(otype T)
+wrapper(T)* ?=?(wrapper(T)* lhs, wrapper(T)* rhs)
+{
+	lhs->value = rhs->value;
+	return lhs;
+}
+
+
+int main(int argc, char const *argv[])
+{
+	wrapper(int) test;
+	test = create();
+	return 0;
+}
Index: examples/gc_no_raii/bug-repro/return_template.c
===================================================================
--- examples/gc_no_raii/bug-repro/return_template.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/return_template.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,17 @@
+forall(otype T)
+struct wrap
+{
+	T value;
+};
+
+forall(otype T) void ?{}(wrap(T)* this);
+forall(otype T) void ?{}(wrap(T)* this, wrap(T)* rhs);
+forall(otype T) void ^?{}(wrap(T)* this);
+forall(otype T) void ?=?(wrap(T)* this, wrap(T)* rhs);
+
+forall(otype T)
+wrap(T) test()
+{
+	wrap(T) tester;
+	return tester;
+}
Index: examples/gc_no_raii/bug-repro/slow_malloc.c
===================================================================
--- examples/gc_no_raii/bug-repro/slow_malloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/slow_malloc.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,20 @@
+#include <stdlib>
+
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+struct card_table_t
+{
+	unsigned long int count;
+	void* cards_start[1000];
+};
+
+int main(int argc, char const *argv[])
+{
+	card_table_t* t = (card_table_t*)malloc(sizeof(card_table_t));
+	return 0;
+}
Index: examples/gc_no_raii/bug-repro/static_const_local.c
===================================================================
--- examples/gc_no_raii/bug-repro/static_const_local.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/static_const_local.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,6 @@
+typedef unsigned long long size_t;
+
+int main(int argc, char const *argv[]) {
+	static const size_t GROWTH_RATE = 2;
+	return 0;
+}
Index: examples/gc_no_raii/bug-repro/test-assert.cpp
===================================================================
--- examples/gc_no_raii/bug-repro/test-assert.cpp	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/test-assert.cpp	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,9 @@
+#include <cassert>
+#include "../src/tools/checks.h"
+
+int main(int argc, char* argv[])
+{
+	//check(false);
+	assert(false);
+	return 0;
+}
Index: examples/gc_no_raii/bug-repro/void_pointer.c
===================================================================
--- examples/gc_no_raii/bug-repro/void_pointer.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/void_pointer.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,18 @@
+#include <stddef.h>
+#include <stdint.h>
+
+inline void* test(intptr_t address)
+{
+	return (void*)address;
+}
+
+//inline void* test2(void* address)
+//{
+//	return address & 0xFF;
+//}
+
+// inline int test()
+// {
+// 	void* d = 0;
+// 	return (int)d;
+// }
Index: examples/gc_no_raii/bug-repro/while.c
===================================================================
--- examples/gc_no_raii/bug-repro/while.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/while.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,14 @@
+extern void* get_member();
+extern void* get_next();
+
+void main()
+{
+	void* member = get_member();
+	void* start_obj = get_next();
+
+	do
+	{
+		start_obj = (void*) ( ((unsigned long int)start_obj) + sizeof(void*) );
+	}
+	while(start_obj > member || !(start_obj) );
+}
Index: examples/gc_no_raii/bug-repro/zero.c
===================================================================
--- examples/gc_no_raii/bug-repro/zero.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
+++ examples/gc_no_raii/bug-repro/zero.c	(revision bf71cfdb7285490eee552b461158846f626cc52f)
@@ -0,0 +1,25 @@
+forall(otype T)
+struct wrap
+{
+    T val;
+};
+
+forall(otype T)
+int ?==? (wrap(T) lhs, wrap(T) rhs)
+{
+    return 0;
+}
+
+/*
+struct wrap(int) 0;
+/*/
+forall(otype T)
+struct wrap(T) 0;
+//*/
+
+int main(int argc, char const *argv[])
+{
+    wrap(int) test;
+    if(test == 0) { return 1; }
+    return 0;
+}
