mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #5300 from Feoramund/fix-5299
Guard against untyped `nil` in type cycle and type info sections
This commit is contained in:
@@ -1413,8 +1413,7 @@ umask :: proc "contextless" (mask: Mode) -> Mode {
|
|||||||
Available since Linux 1.0.
|
Available since Linux 1.0.
|
||||||
*/
|
*/
|
||||||
gettimeofday :: proc "contextless" (tv: ^Time_Val) -> (Errno) {
|
gettimeofday :: proc "contextless" (tv: ^Time_Val) -> (Errno) {
|
||||||
null: uintptr
|
ret := syscall(SYS_gettimeofday, tv, rawptr(nil))
|
||||||
ret := syscall(SYS_gettimeofday, tv, null)
|
|
||||||
return Errno(-ret)
|
return Errno(-ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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) {
|
gb_internal void add_type_info_for_type_definitions(Checker *c) {
|
||||||
for_array(i, c->info.definitions) {
|
for_array(i, c->info.definitions) {
|
||||||
Entity *e = c->info.definitions[i];
|
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);
|
i64 align = type_align_of(e->type);
|
||||||
if (align > 0 && ptr_set_exists(&c->info.minimum_dependency_set, e)) {
|
if (align > 0 && ptr_set_exists(&c->info.minimum_dependency_set, e)) {
|
||||||
add_type_info_type(&c->builtin_ctx, e->type);
|
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
|
// NOTE(bill): Check for illegal cyclic type declarations
|
||||||
for_array(i, c->info.definitions) {
|
for_array(i, c->info.definitions) {
|
||||||
Entity *e = c->info.definitions[i];
|
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);
|
(void)type_align_of(e->type);
|
||||||
} else if (e->kind == Entity_Procedure) {
|
} else if (e->kind == Entity_Procedure) {
|
||||||
DeclInfo *decl = e->decl_info;
|
DeclInfo *decl = e->decl_info;
|
||||||
|
|||||||
Reference in New Issue
Block a user