mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 00:28:23 +02:00
* insert JVM checkcast instructions when a voidpointer is implicitly
converted to an incompatible type git-svn-id: trunk@27744 -
This commit is contained in:
parent
675498a53e
commit
2075bf157e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10897,6 +10897,7 @@ tests/test/jvm/tprop.pp svneol=native#text/plain
|
||||
tests/test/jvm/tprop2.pp svneol=native#text/plain
|
||||
tests/test/jvm/tprop3.pp svneol=native#text/plain
|
||||
tests/test/jvm/tprop4.pp svneol=native#text/plain
|
||||
tests/test/jvm/tptrdynarr.pp svneol=native#text/plain
|
||||
tests/test/jvm/tpvar.pp svneol=native#text/plain
|
||||
tests/test/jvm/tpvardelphi.pp svneol=native#text/plain
|
||||
tests/test/jvm/tpvarglobal.pp svneol=native#text/plain
|
||||
|
@ -258,7 +258,13 @@ implementation
|
||||
|
||||
function tjvmtypeconvnode.pass_1: tnode;
|
||||
begin
|
||||
if (nf_explicit in flags) then
|
||||
if (nf_explicit in flags) or
|
||||
{ some implicit type conversions from voidpointer to other types
|
||||
(such as dynamic array) are allowed too, even though the types are
|
||||
incompatible -> make sure we check those too and insert checkcast
|
||||
instructions as necessary }
|
||||
(is_voidpointer(left.resultdef) and
|
||||
not is_voidpointer(resultdef)) then
|
||||
begin
|
||||
do_target_specific_explicit_typeconv(false,result);
|
||||
if assigned(result) then
|
||||
|
@ -290,3 +290,7 @@ echo " ** Compilation failed as expected"
|
||||
ppcjvm -O2 -g -B toverload2
|
||||
if %errorlevel% eq 0 exit /b 1
|
||||
echo " ** Compilation failed as expected"
|
||||
ppcjvm -O2 -g -B -CTinitlocals tptrdynarr
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. tptrdynarr
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
@ -172,3 +172,5 @@ else
|
||||
echo " ** Compilation failed as expected"
|
||||
fi
|
||||
set -e
|
||||
$PPC -O2 -g -B -Sa tptrdynarr
|
||||
java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tptrdynarr
|
||||
|
11
tests/test/jvm/tptrdynarr.pp
Normal file
11
tests/test/jvm/tptrdynarr.pp
Normal file
@ -0,0 +1,11 @@
|
||||
{$mode delphi}
|
||||
|
||||
program tptrdynarr;
|
||||
|
||||
var
|
||||
p: pointer;
|
||||
a: array of byte;
|
||||
begin
|
||||
p:=nil;
|
||||
a:=p;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user