mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 10:51:08 +02:00
* range checking in units doesn't work if the units are smartlinked, fixed
This commit is contained in:
parent
716cbb642f
commit
491cd2afe3
@ -120,7 +120,7 @@ implementation
|
||||
end
|
||||
else internalerror(6);
|
||||
hp:=new_reference(R_NO,0);
|
||||
hp^.symbol:=stringdup('R_'+tostr(porddef(p1)^.rangenr));
|
||||
hp^.symbol:=stringdup(porddef(p1)^.getrangecheckstring);
|
||||
if porddef(p1)^.low>porddef(p1)^.high then
|
||||
begin
|
||||
getlabel(neglabel);
|
||||
@ -132,7 +132,7 @@ implementation
|
||||
if porddef(p1)^.low>porddef(p1)^.high then
|
||||
begin
|
||||
hp:=new_reference(R_NO,0);
|
||||
hp^.symbol:=stringdup('R_'+tostr(porddef(p1)^.rangenr+1));
|
||||
hp^.symbol:=stringdup(porddef(p1)^.getrangecheckstring);
|
||||
emitl(A_JMP,poslabel);
|
||||
emitl(A_LABEL,neglabel);
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_BOUND,S_L,hregister,hp)));
|
||||
@ -183,13 +183,13 @@ implementation
|
||||
exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
|
||||
newreference(p^.location.reference),R_EDI)));
|
||||
hpp:=new_reference(R_NO,0);
|
||||
hpp^.symbol:=stringdup('R_'+tostr(porddef(hp^.resulttype)^.rangenr));
|
||||
hpp^.symbol:=stringdup(porddef(hp^.resulttype)^.getrangecheckstring);
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_BOUND,S_L,hregister,hpp)));
|
||||
|
||||
{ then we do a normal range check }
|
||||
porddef(p^.resulttype)^.genrangecheck;
|
||||
hpp:=new_reference(R_NO,0);
|
||||
hpp^.symbol:=stringdup('R_'+tostr(porddef(p^.resulttype)^.rangenr));
|
||||
hpp^.symbol:=stringdup(porddef(p^.resulttype)^.getrangecheckstring);
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_BOUND,S_L,hregister,hpp)));
|
||||
end
|
||||
else
|
||||
@ -225,7 +225,7 @@ implementation
|
||||
end
|
||||
else internalerror(6);
|
||||
hpp:=new_reference(R_NO,0);
|
||||
hpp^.symbol:=stringdup('R_'+tostr(porddef(p^.resulttype)^.rangenr));
|
||||
hpp^.symbol:=stringdup(porddef(p^.resulttype)^.getrangecheckstring);
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_BOUND,S_L,hregister,hpp)));
|
||||
(*
|
||||
if (p^.location.loc=LOC_REGISTER) or
|
||||
@ -453,7 +453,6 @@ implementation
|
||||
st_shortstring:
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
push_int(p^.resulttype^.size-1);
|
||||
gettempofsizereference(p^.resulttype^.size,p^.location.reference);
|
||||
emitpushreferenceaddr(exprasmlist,p^.location.reference);
|
||||
case p^.left^.location.loc of
|
||||
@ -1311,7 +1310,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.25 1998-09-30 12:14:24 peter
|
||||
Revision 1.26 1998-10-02 07:20:35 florian
|
||||
* range checking in units doesn't work if the units are smartlinked, fixed
|
||||
|
||||
Revision 1.25 1998/09/30 12:14:24 peter
|
||||
* fixed boolean(longbool) conversion
|
||||
|
||||
Revision 1.24 1998/09/27 10:16:22 florian
|
||||
|
@ -568,7 +568,7 @@ implementation
|
||||
begin
|
||||
hp:=new_reference(R_NO,0);
|
||||
parraydef(p^.left^.resulttype)^.genrangecheck;
|
||||
hp^.symbol:=stringdup('R_'+tostr(parraydef(p^.left^.resulttype)^.rangenr));
|
||||
hp^.symbol:=stringdup(parraydef(p^.left^.resulttype)^.getrangecheckstring);
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_BOUND,S_L,ind,hp)));
|
||||
end;
|
||||
end;
|
||||
@ -673,7 +673,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.13 1998-09-27 10:16:23 florian
|
||||
Revision 1.14 1998-10-02 07:20:37 florian
|
||||
* range checking in units doesn't work if the units are smartlinked, fixed
|
||||
|
||||
Revision 1.13 1998/09/27 10:16:23 florian
|
||||
* type casts pchar<->ansistring fixed
|
||||
* ansistring[..] calls does now an unique call
|
||||
|
||||
|
@ -846,6 +846,14 @@
|
||||
rangenr:=0;
|
||||
end;
|
||||
|
||||
function torddef.getrangecheckstring : string;
|
||||
|
||||
begin
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
getrangecheckstring:='R_'+current_module^.modulename^+tostr(rangenr)
|
||||
else
|
||||
getrangecheckstring:='R_'+tostr(rangenr);
|
||||
end;
|
||||
|
||||
procedure torddef.genrangecheck;
|
||||
begin
|
||||
@ -854,9 +862,9 @@
|
||||
{ generate two constant for bounds }
|
||||
getlabelnr(rangenr);
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
datasegment^.concat(new(pai_symbol,init_global('R_'+current_module^.modulename^+tostr(rangenr))))
|
||||
datasegment^.concat(new(pai_symbol,init_global(getrangecheckstring)))
|
||||
else
|
||||
datasegment^.concat(new(pai_symbol,init('R_'+tostr(rangenr))));
|
||||
datasegment^.concat(new(pai_symbol,init(getrangecheckstring)));
|
||||
if low<=high then
|
||||
begin
|
||||
datasegment^.concat(new(pai_const,init_32bit(low)));
|
||||
@ -1432,6 +1440,15 @@
|
||||
rangenr:=0;
|
||||
end;
|
||||
|
||||
function tarraydef.getrangecheckstring : string;
|
||||
|
||||
begin
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
getrangecheckstring:='R_'+current_module^.modulename^+tostr(rangenr)
|
||||
else
|
||||
getrangecheckstring:='R_'+tostr(rangenr);
|
||||
end;
|
||||
|
||||
|
||||
procedure tarraydef.genrangecheck;
|
||||
begin
|
||||
@ -1439,7 +1456,10 @@
|
||||
begin
|
||||
{ generates the data for range checking }
|
||||
getlabelnr(rangenr);
|
||||
datasegment^.concat(new(pai_symbol,init('R_'+tostr(rangenr))));
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
datasegment^.concat(new(pai_symbol,init(getrangecheckstring)))
|
||||
else
|
||||
datasegment^.concat(new(pai_symbol,init_global(getrangecheckstring)));
|
||||
datasegment^.concat(new(pai_const,init_32bit(lowrange)));
|
||||
datasegment^.concat(new(pai_const,init_32bit(highrange)));
|
||||
end;
|
||||
@ -3025,7 +3045,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.51 1998-09-25 12:01:41 florian
|
||||
Revision 1.52 1998-10-02 07:20:38 florian
|
||||
* range checking in units doesn't work if the units are smartlinked, fixed
|
||||
|
||||
Revision 1.51 1998/09/25 12:01:41 florian
|
||||
* tobjectdef.publicsyms.datasize was set to savesize, this is wrong now
|
||||
because the symtable size is read from the ppu file
|
||||
|
||||
|
@ -209,6 +209,9 @@
|
||||
|
||||
parraydef = ^tarraydef;
|
||||
tarraydef = object(tdef)
|
||||
private
|
||||
rangenr : longint;
|
||||
public
|
||||
lowrange,
|
||||
highrange : longint;
|
||||
definition : pdef;
|
||||
@ -216,7 +219,6 @@
|
||||
IsVariant,
|
||||
IsConstructor,
|
||||
IsArrayOfConst : boolean;
|
||||
rangenr : longint;
|
||||
function elesize : longint;
|
||||
constructor init(l,h : longint;rd : pdef);
|
||||
constructor load;
|
||||
@ -230,6 +232,9 @@
|
||||
{ generates the ranges needed by the asm instruction BOUND (i386)
|
||||
or CMP2 (Motorola) }
|
||||
procedure genrangecheck;
|
||||
|
||||
{ returns the label of the range check string }
|
||||
function getrangecheckstring : string;
|
||||
function needs_inittable : boolean;virtual;
|
||||
procedure write_rtti_data;virtual;
|
||||
procedure write_child_rtti_table;virtual;
|
||||
@ -279,6 +284,8 @@
|
||||
{ generates the ranges needed by the asm instruction BOUND }
|
||||
{ or CMP2 (Motorola) }
|
||||
procedure genrangecheck;
|
||||
{ returns the label of the range check string }
|
||||
function getrangecheckstring : string;
|
||||
procedure write_rtti_data;virtual;
|
||||
function is_publishable : boolean;virtual;
|
||||
end;
|
||||
@ -470,7 +477,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-09-23 12:03:57 peter
|
||||
Revision 1.2 1998-10-02 07:20:40 florian
|
||||
* range checking in units doesn't work if the units are smartlinked, fixed
|
||||
|
||||
Revision 1.1 1998/09/23 12:03:57 peter
|
||||
* overloading fix for array of const
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user