* prevent some IEs with delphi methodpointers

This commit is contained in:
peter 2004-11-29 17:32:56 +00:00
parent 1fa574257d
commit 5f61be6b4d
4 changed files with 32 additions and 24 deletions

View File

@ -695,6 +695,7 @@ implementation
ordinals to pointer.
It is also used by the compiler internally for inc(pointer,ordinal) }
if (eq=te_incompatible) and
not is_void(def_from) and
(
(
(m_delphi in aktmodeswitches) and
@ -1311,7 +1312,10 @@ implementation
end.
{
$Log$
Revision 1.60 2004-11-26 22:33:54 peter
Revision 1.61 2004-11-29 17:32:56 peter
* prevent some IEs with delphi methodpointers
Revision 1.60 2004/11/26 22:33:54 peter
* don't allow pointer(ordinal) typecast in fpc mode, only allow it
for delphi and for internal use

View File

@ -398,7 +398,6 @@ interface
begin
location.register:=cg.getaddressregister(exprasmlist);
cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.register);
// location_freetemp(exprasmlist,left.location);
end;
else
internalerror(2002032214);
@ -466,6 +465,8 @@ interface
procedure tcgtypeconvnode.second_nothing;
var
newsize : tcgsize;
begin
{ we reuse the old value }
location_copy(location,left.location);
@ -477,9 +478,11 @@ interface
location_force_mem(exprasmlist,location);
{ but use the new size, but we don't know the size of all arrays }
location.size:=def_cgsize(resulttype.def);
newsize:=def_cgsize(resulttype.def);
if location.loc in [LOC_REGISTER,LOC_CREGISTER] then
location.register:=cg.makeregsize(exprasmlist,location.register,location.size);
location_force_reg(exprasmlist,location,newsize,false)
else
location.size:=newsize;
end;
@ -531,7 +534,10 @@ end.
{
$Log$
Revision 1.63 2004-11-01 17:41:28 florian
Revision 1.64 2004-11-29 17:32:56 peter
* prevent some IEs with delphi methodpointers
Revision 1.63 2004/11/01 17:41:28 florian
* fixed arm compilation with cgutils
* ...

View File

@ -383,7 +383,6 @@ implementation
old_allow_multi_pass2,
releaseright : boolean;
len : aint;
cgsize : tcgsize;
r:Tregister;
begin
@ -574,19 +573,18 @@ implementation
LOC_REGISTER,
LOC_CREGISTER :
begin
cgsize:=def_cgsize(left.resulttype.def);
{$ifndef cpu64bit}
if cgsize in [OS_64,OS_S64] then
if left.location.size in [OS_64,OS_S64] then
cg64.a_load64_ref_reg(exprasmlist,right.location.reference,left.location.register64)
else
{$endif cpu64bit}
cg.a_load_ref_reg(exprasmlist,cgsize,cgsize,right.location.reference,left.location.register);
cg.a_load_ref_reg(exprasmlist,right.location.size,left.location.size,right.location.reference,left.location.register);
end;
LOC_FPUREGISTER,
LOC_CFPUREGISTER :
begin
cg.a_loadfpu_ref_reg(exprasmlist,
def_cgsize(right.resulttype.def),
right.location.size,
right.location.reference,
left.location.register);
end;
@ -624,7 +622,6 @@ implementation
end
else
begin
cgsize:=def_cgsize(left.resulttype.def);
if left.location.loc=LOC_CMMREGISTER then
cg.a_loadmm_reg_reg(exprasmlist,right.location.size,left.location.size,right.location.register,left.location.register,mms_movescalar)
else
@ -634,9 +631,8 @@ implementation
LOC_REGISTER,
LOC_CREGISTER :
begin
cgsize:=def_cgsize(left.resulttype.def);
{$ifndef cpu64bit}
if cgsize in [OS_64,OS_S64] then
if left.location.size in [OS_64,OS_S64] then
cg64.a_load64_reg_loc(exprasmlist,
right.location.register64,left.location)
else
@ -663,7 +659,6 @@ implementation
end;
LOC_JUMP :
begin
cgsize:=def_cgsize(left.resulttype.def);
objectlibrary.getlabel(hlabel);
{ generate the leftnode for the true case, and
release the location }
@ -957,7 +952,10 @@ begin
end.
{
$Log$
Revision 1.132 2004-11-09 17:26:47 peter
Revision 1.133 2004-11-29 17:32:56 peter
* prevent some IEs with delphi methodpointers
Revision 1.132 2004/11/09 17:26:47 peter
* fixed wrong typecasts
Revision 1.131 2004/11/08 22:09:59 peter

View File

@ -390,10 +390,6 @@ implementation
else
if (left.nodetype=loadn) and (tloadnode(left).symtableentry.typ=procsym) then
begin
{ the address is already available when loading a procedure of object }
if assigned(tloadnode(left).left) then
include(flags,nf_procvarload);
{ result is a procedure variable }
{ No, to be TP compatible, you must return a voidpointer to
the procedure that is stored in the procvar.}
@ -425,7 +421,9 @@ implementation
{ only need the address of the method? this is needed
for @tobject.create }
if not assigned(tloadnode(left).left) then
if assigned(tloadnode(left).left) then
include(flags,nf_procvarload)
else
include(tprocvardef(resulttype.def).procoptions,po_addressonly);
{ Add parameters use only references, we don't need to keep the
@ -437,9 +435,8 @@ implementation
else
begin
if assigned(tloadnode(left).left) then
CGMessage(parser_e_illegal_expression)
else
resulttype:=voidpointertype;
CGMessage(parser_e_illegal_expression);
resulttype:=voidpointertype;
end;
end
else
@ -1000,7 +997,10 @@ begin
end.
{
$Log$
Revision 1.90 2004-11-26 22:33:24 peter
Revision 1.91 2004-11-29 17:32:56 peter
* prevent some IEs with delphi methodpointers
Revision 1.90 2004/11/26 22:33:24 peter
* don't allow @method in tp procvar mode
Revision 1.89 2004/11/15 23:35:31 peter