From 54f018ffc7c76d12598c0fd8f6aca9b2030e9992 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sun, 8 Jun 2025 17:43:56 -0400 Subject: [PATCH 1/2] Guard against untyped `nil` in type cycle and type info sections Fixes #5299 --- src/checker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/checker.cpp b/src/checker.cpp index ff7194835..67dee9963 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -6672,7 +6672,7 @@ gb_internal void check_sort_init_and_fini_procedures(Checker *c) { gb_internal void add_type_info_for_type_definitions(Checker *c) { for_array(i, c->info.definitions) { Entity *e = c->info.definitions[i]; - if (e->kind == Entity_TypeName && e->type != nullptr) { + if (e->kind == Entity_TypeName && e->type != nullptr && is_type_typed(e->type)) { i64 align = type_align_of(e->type); if (align > 0 && ptr_set_exists(&c->info.minimum_dependency_set, e)) { add_type_info_type(&c->builtin_ctx, e->type); @@ -6794,7 +6794,7 @@ gb_internal void check_parsed_files(Checker *c) { // NOTE(bill): Check for illegal cyclic type declarations for_array(i, c->info.definitions) { Entity *e = c->info.definitions[i]; - if (e->kind == Entity_TypeName && e->type != nullptr) { + if (e->kind == Entity_TypeName && e->type != nullptr && is_type_typed(e->type)) { (void)type_align_of(e->type); } else if (e->kind == Entity_Procedure) { DeclInfo *decl = e->decl_info; From 0747032e4a836a4295538d2c4945f2610ad2e615 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sun, 8 Jun 2025 17:46:48 -0400 Subject: [PATCH 2/2] Use idiomatic `rawptr(nil)` --- core/sys/linux/sys.odin | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/sys/linux/sys.odin b/core/sys/linux/sys.odin index f28a5fdb2..deb22726f 100644 --- a/core/sys/linux/sys.odin +++ b/core/sys/linux/sys.odin @@ -1413,8 +1413,7 @@ umask :: proc "contextless" (mask: Mode) -> Mode { Available since Linux 1.0. */ gettimeofday :: proc "contextless" (tv: ^Time_Val) -> (Errno) { - null: uintptr - ret := syscall(SYS_gettimeofday, tv, null) + ret := syscall(SYS_gettimeofday, tv, rawptr(nil)) return Errno(-ret) }