Parcourir la source

Fix ICE on missing procedure in base:runtime

When a required built-in procedure is missing from the base:runtime
package, an assert should be triggered. However this does not happen
and instead the compiler crashes silently. The cause is the
null-dereference after scope_lookup_current returns nullptr.

This adds an assertion that the runtime procedure is found, before
proceeding to check it's type and performing further lookups.
Sunagatov Denis il y a 1 mois
Parent
commit
46b7abee9f
1 fichiers modifiés avec 1 ajouts et 0 suppressions
  1. 1 0
      src/llvm_backend_general.cpp

+ 1 - 0
src/llvm_backend_general.cpp

@@ -2792,6 +2792,7 @@ gb_internal lbValue lb_find_ident(lbProcedure *p, lbModule *m, Entity *e, Ast *e
 gb_internal lbValue lb_find_procedure_value_from_entity(lbModule *m, Entity *e) {
 	lbGenerator *gen = m->gen;
 
+	GB_ASSERT(e != nullptr);
 	GB_ASSERT(is_type_proc(e->type));
 	e = strip_entity_wrapping(e);
 	GB_ASSERT(e != nullptr);