mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-06 01:38:39 +02:00
* moved the floating point constant range checking code from
pass_generate_code to pass_typecheck, so that it's also used by targets that override pass_generate_code (fixes webtbs/tw16315b for LLVM) git-svn-id: trunk@35021 -
This commit is contained in:
parent
006c7e1ccf
commit
1afab1ab69
@ -144,10 +144,6 @@ implementation
|
||||
aitrealconst_s32bit :
|
||||
begin
|
||||
current_asmdata.asmlists[al_typedconsts].concat(tai_realconst.create_s32real(ts32real(value_real)));
|
||||
{ range checking? }
|
||||
if floating_point_range_check_error and
|
||||
(tai_realconst(current_asmdata.asmlists[al_typedconsts].last).value.s32val=MathInf.Value) then
|
||||
Message(parser_e_range_check_error);
|
||||
end;
|
||||
|
||||
aitrealconst_s64bit :
|
||||
@ -158,31 +154,16 @@ implementation
|
||||
else
|
||||
{$endif ARM}
|
||||
current_asmdata.asmlists[al_typedconsts].concat(tai_realconst.create_s64real(ts64real(value_real)));
|
||||
|
||||
{ range checking? }
|
||||
if floating_point_range_check_error and
|
||||
(tai_realconst(current_asmdata.asmlists[al_typedconsts].last).value.s64val=MathInf.Value) then
|
||||
Message(parser_e_range_check_error);
|
||||
end;
|
||||
|
||||
aitrealconst_s80bit :
|
||||
begin
|
||||
current_asmdata.asmlists[al_typedconsts].concat(tai_realconst.create_s80real(value_real,tfloatdef(resultdef).size));
|
||||
|
||||
{ range checking? }
|
||||
if floating_point_range_check_error and
|
||||
(tai_realconst(current_asmdata.asmlists[al_typedconsts].last).value.s80val=MathInf.Value) then
|
||||
Message(parser_e_range_check_error);
|
||||
end;
|
||||
{$ifdef cpufloat128}
|
||||
aitrealconst_s128bit :
|
||||
begin
|
||||
current_asmdata.asmlists[al_typedconsts].concat(tai_realconst.create_s128real(value_real));
|
||||
|
||||
{ range checking? }
|
||||
if floating_point_range_check_error and
|
||||
(tai_realconst(current_asmdata.asmlists[al_typedconsts].last).value.s128val=MathInf.Value) then
|
||||
Message(parser_e_range_check_error);
|
||||
end;
|
||||
{$endif cpufloat128}
|
||||
|
||||
|
@ -391,12 +391,57 @@ implementation
|
||||
dogetcopy:=n;
|
||||
end;
|
||||
|
||||
|
||||
function trealconstnode.pass_typecheck:tnode;
|
||||
begin
|
||||
result:=nil;
|
||||
resultdef:=typedef;
|
||||
|
||||
{ range checking? }
|
||||
if floating_point_range_check_error or
|
||||
(tfloatdef(resultdef).floattype in [s64comp,s64currency]) then
|
||||
begin
|
||||
{ use CGMessage so that the resultdef will get set to errordef
|
||||
by pass1.typecheckpass_internal if a range error was triggered,
|
||||
which in turn will prevent any potential parent type conversion
|
||||
node from creating a new realconstnode with this exact same value
|
||||
and hence trigger the same error again }
|
||||
case tfloatdef(resultdef).floattype of
|
||||
s32real :
|
||||
begin
|
||||
if ts32real(value_real)=MathInf.Value then
|
||||
CGMessage(parser_e_range_check_error);
|
||||
end;
|
||||
s64real:
|
||||
begin
|
||||
if ts64real(value_real)=MathInf.Value then
|
||||
CGMessage(parser_e_range_check_error);
|
||||
end;
|
||||
s80real,
|
||||
sc80real:
|
||||
begin
|
||||
if ts80real(value_real)=MathInf.Value then
|
||||
CGMessage(parser_e_range_check_error);
|
||||
end;
|
||||
s64comp,
|
||||
s64currency:
|
||||
begin
|
||||
if (value_real>9223372036854775807.0) or
|
||||
(value_real<-9223372036854775808.0) then
|
||||
CGMessage(parser_e_range_check_error)
|
||||
end;
|
||||
s128real:
|
||||
begin
|
||||
if ts128real(value_real)=MathInf.Value then
|
||||
CGMessage(parser_e_range_check_error);
|
||||
end;
|
||||
else
|
||||
internalerror(2016112902);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function trealconstnode.pass_1 : tnode;
|
||||
begin
|
||||
result:=nil;
|
||||
@ -405,6 +450,7 @@ implementation
|
||||
include(current_procinfo.flags,pi_needs_got);
|
||||
end;
|
||||
|
||||
|
||||
function trealconstnode.docompare(p: tnode): boolean;
|
||||
begin
|
||||
docompare :=
|
||||
|
Loading…
Reference in New Issue
Block a user