mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:09:25 +02:00
* fixed some voidpointerdef handling
git-svn-id: branches/jvmbackend@18584 -
This commit is contained in:
parent
ba5e264a93
commit
0fad10179c
@ -259,7 +259,9 @@ implementation
|
||||
else
|
||||
result:=R_ADDRESSREGISTER;
|
||||
{ shortstrings are implemented via classes }
|
||||
else if is_shortstring(def) then
|
||||
else if is_shortstring(def) or
|
||||
{ voiddef can only be typecasted into (implicit) pointers }
|
||||
is_void(def) then
|
||||
result:=R_ADDRESSREGISTER
|
||||
else
|
||||
result:=inherited;
|
||||
|
@ -644,6 +644,15 @@ implementation
|
||||
((resultdef.typ in [stringdef,classrefdef]) and
|
||||
not is_shortstring(resultdef)) or
|
||||
procvarconv;
|
||||
{ typescasts from void (the result of untyped_ptr^) to an implicit
|
||||
pointertype (record, array, ...) also needs a typecheck }
|
||||
if is_void(left.resultdef) and
|
||||
jvmimplicitpointertype(resultdef) then
|
||||
begin
|
||||
fromclasscompatible:=true;
|
||||
toclasscompatible:=true;
|
||||
end;
|
||||
|
||||
if fromclasscompatible and toclasscompatible then
|
||||
begin
|
||||
{ we need an as-node to check the validity of the conversion (since
|
||||
|
@ -73,7 +73,8 @@ implementation
|
||||
begin
|
||||
result:=inherited;
|
||||
if not(left.resultdef.typ=pointerdef) or
|
||||
not jvmimplicitpointertype(tpointerdef(left.resultdef).pointeddef) then
|
||||
((left.resultdef<>voidpointertype) and
|
||||
not jvmimplicitpointertype(tpointerdef(left.resultdef).pointeddef)) then
|
||||
begin
|
||||
CGMessage(parser_e_illegal_expression);
|
||||
exit
|
||||
@ -83,8 +84,9 @@ implementation
|
||||
procedure tjvmderefnode.pass_generate_code;
|
||||
begin
|
||||
secondpass(left);
|
||||
if (left.resultdef.typ=pointerdef) or
|
||||
jvmimplicitpointertype(left.resultdef) then
|
||||
if (left.resultdef.typ=pointerdef) and
|
||||
((left.resultdef=voidpointertype) or
|
||||
jvmimplicitpointertype(tpointerdef(left.resultdef).pointeddef)) then
|
||||
begin
|
||||
{ this is basically a typecast: the left node is a regular
|
||||
'pointer', and we typecast it to an implicit pointer }
|
||||
|
Loading…
Reference in New Issue
Block a user