diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-29 15:21:22 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-29 15:21:22 +0000 |
commit | fb1e3666867661b55e01e2f6b2c6dc6384450c09 (patch) | |
tree | 86947fbfcf8377b75ecf29456a00372533ab8f22 | |
parent | 8565cc4bf19c4a9675a497b33c845f75d139a7af (diff) | |
download | fpc-fb1e3666867661b55e01e2f6b2c6dc6384450c09.tar.gz |
Merging r32904
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/fixes_3_0@33844 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/jvm/njvmcnv.pas | 15 | ||||
-rw-r--r-- | compiler/ncnv.pas | 13 |
2 files changed, 27 insertions, 1 deletions
diff --git a/compiler/jvm/njvmcnv.pas b/compiler/jvm/njvmcnv.pas index 899db03a5b..318b9f2577 100644 --- a/compiler/jvm/njvmcnv.pas +++ b/compiler/jvm/njvmcnv.pas @@ -30,6 +30,8 @@ interface type tjvmtypeconvnode = class(tcgtypeconvnode) + class function target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; override; + function typecheck_dynarray_to_openarray: tnode; override; function typecheck_string_to_chararray: tnode; override; function typecheck_string_to_string: tnode;override; @@ -148,6 +150,19 @@ implementation end; + class function tjvmtypeconvnode.target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; + begin + result:= + (fromdef<>todef) and + { two procdefs that are structurally the same but semantically different + still need a convertion } + ( + ((fromdef.typ=procvardef) and + (todef.typ=procvardef)) + ); + end; + + function tjvmtypeconvnode.typecheck_dynarray_to_openarray: tnode; begin { all arrays are equal in Java } diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 1c10989402..56bcdf417d 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -65,6 +65,10 @@ interface replace this explicit type conversion with a different node, or to reject it after all } function target_specific_explicit_typeconv: boolean;virtual; + + { called when inserttypeconv is used to convert to a def that is equal + according to compare_defs() } + class function target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; virtual; protected function typecheck_int_to_int : tnode; virtual; function typecheck_cord_to_pointer : tnode; virtual; @@ -326,7 +330,8 @@ implementation still expects the resultdef of the node to be a stringdef) } if equal_defs(p.resultdef,def) and (p.resultdef.typ=def.typ) and - not is_bitpacked_access(p) then + not is_bitpacked_access(p) and + not ctypeconvnode.target_specific_need_equal_typeconv(p.resultdef,def) then begin { don't replace encoded string constants to rawbytestring encoding. preserve the codepage } @@ -1991,6 +1996,12 @@ implementation end; + class function ttypeconvnode.target_specific_need_equal_typeconv(fromdef, todef: tdef): boolean; + begin + result:=false; + end; + + function ttypeconvnode.typecheck_proc_to_procvar : tnode; var pd : tabstractprocdef; |