* Check that system unit is actually loaded before using it to search for system symbols

This commit is contained in:
Michael VAN CANNEYT 2023-01-05 09:44:12 +01:00
parent 391fdcac08
commit 9e5ee68887
4 changed files with 401 additions and 385 deletions

View File

@ -30,6 +30,7 @@
# exec_ calls to assembler, external linker, binder
# link_ internal linker
# package_ package handling
# sym_ symbol handling
#
# <type> the type of the message it should normally used for
# f_ fatal error
@ -2437,6 +2438,10 @@ sym_e_type_must_be_rec_or_object=05098_E_Record or object type expected
sym_e_symbol_no_capture=05099_E_Symbol "$1" can not be captured
% The specified symbol can not be captured to be used in a function reference.
% For example \var{var} or \var{out} parameters can not be captured in that way.
sym_f_systemunitnotloaded=05100_F_System unit not loaded.
% The compiler used a function that requires the system unit to be loaded,
% but it was not yet loaded. This is an internal compiler error and must be reported.
%
% \end{description}
#
# Codegenerator

View File

@ -689,6 +689,7 @@ const
sym_e_generic_type_param_decl=05097;
sym_e_type_must_be_rec_or_object=05098;
sym_e_symbol_no_capture=05099;
sym_f_systemunitnotloaded=05100;
cg_e_parasize_too_big=06009;
cg_e_file_must_call_by_reference=06012;
cg_e_cant_use_far_pointer_there=06013;
@ -1162,9 +1163,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 91070;
MsgTxtSize = 91102;
MsgIdxMax : array[1..20] of longint=(
28,109,368,132,100,63,148,38,223,71,
28,109,368,132,101,63,148,38,223,71,
68,20,30,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -3071,11 +3071,17 @@ implementation
end;
end;
procedure check_systemunit_loaded; inline;
begin
if systemunit=nil then
Message(sym_f_systemunitnotloaded);
end;
procedure write_system_parameter_lists(const name:string);
var
srsym:tprocsym;
begin
check_systemunit_loaded;
srsym:=tprocsym(systemunit.find(name));
if not assigned(srsym) or not (srsym.typ=procsym) then
internalerror(2016060302);
@ -4218,6 +4224,7 @@ implementation
var
sym : tsym;
begin
check_systemunit_loaded;
sym:=tsym(systemunit.Find(s));
if not assigned(sym) or
(sym.typ<>typesym) then
@ -4230,6 +4237,7 @@ implementation
var
sym : tsym;
begin
check_systemunit_loaded;
sym:=tsym(systemunit.Find(s));
if not assigned(sym) then
result:=nil
@ -4267,6 +4275,7 @@ implementation
var
srsym: tsym;
begin
check_systemunit_loaded;
srsym:=tsym(systemunit.find(s));
if not assigned(srsym) and
(cs_compilesystem in current_settings.moduleswitches) then