Browse Source

Fix CompositeType for zero length arrays

gingerBill 6 years ago
parent
commit
7c99884afb
2 changed files with 5 additions and 2 deletions
  1. 3 0
      src/checker.cpp
  2. 2 2
      src/ir_print.cpp

+ 3 - 0
src/checker.cpp

@@ -558,6 +558,9 @@ void init_universal(void) {
 	add_global_entity(alloc_entity_nil(str_lit("nil"), t_untyped_nil));
 
 	// TODO(bill): Set through flags in the compiler
+	add_global_string_constant(str_lit("ODIN_OS"),      bc->ODIN_OS);
+	add_global_string_constant(str_lit("ODIN_ARCH"),    bc->ODIN_ARCH);
+	add_global_string_constant(str_lit("ODIN_ENDIAN"),  bc->ODIN_ENDIAN);
 	add_global_string_constant(str_lit("ODIN_VENDOR"),  bc->ODIN_VENDOR);
 	add_global_string_constant(str_lit("ODIN_VERSION"), bc->ODIN_VERSION);
 	add_global_string_constant(str_lit("ODIN_ROOT"),    bc->ODIN_ROOT);

+ 2 - 2
src/ir_print.cpp

@@ -2374,9 +2374,9 @@ void print_llvm_ir(irGen *ir) {
 			case irDebugInfo_CompositeType: {
 				if (di->CompositeType.tag == irDebugBasicEncoding_array_type) {
 					GB_ASSERT_NOT_NULL(di->CompositeType.base_type);
-					GB_ASSERT(di->CompositeType.array_count > 0);
+					GB_ASSERT(di->CompositeType.array_count >= 0);
 					GB_ASSERT(di->CompositeType.name.len == 0);
-					GB_ASSERT(di->CompositeType.size > 0);
+					GB_ASSERT(di->CompositeType.size >= 0);
 				}
 
 				if (di->CompositeType.tag == irDebugBasicEncoding_union_type) {