mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 13:49:39 +02:00
Fixed optimization Length(W)=0
-> (Pointer(W)=nil) or (PLongword(Pointer(W)-4)^=0)
for WideString
This commit is contained in:
parent
7b39089d4f
commit
35db2b2da3
@ -460,11 +460,16 @@ implementation
|
|||||||
function TransformLengthZero(n1,n2 : tnode) : tnode;
|
function TransformLengthZero(n1,n2 : tnode) : tnode;
|
||||||
var
|
var
|
||||||
len : Tconstexprint;
|
len : Tconstexprint;
|
||||||
|
lentype : tdef;
|
||||||
begin
|
begin
|
||||||
if is_dynamic_array(tinlinenode(n1).left.resultdef) then
|
if is_dynamic_array(tinlinenode(n1).left.resultdef) then
|
||||||
len:=-1
|
len:=-1
|
||||||
else
|
else
|
||||||
len:=0;
|
len:=0;
|
||||||
|
if is_widestring(tinlinenode(n1).left.resultdef) and (tf_winlikewidestring in target_info.flags) then
|
||||||
|
lentype:=u32inttype
|
||||||
|
else
|
||||||
|
lentype:=sizesinttype;
|
||||||
result:=caddnode.create_internal(orn,
|
result:=caddnode.create_internal(orn,
|
||||||
caddnode.create_internal(equaln,ctypeconvnode.create_internal(tinlinenode(n1).left.getcopy,voidpointertype),
|
caddnode.create_internal(equaln,ctypeconvnode.create_internal(tinlinenode(n1).left.getcopy,voidpointertype),
|
||||||
cpointerconstnode.create(0,voidpointertype)),
|
cpointerconstnode.create(0,voidpointertype)),
|
||||||
@ -472,10 +477,10 @@ implementation
|
|||||||
ctypeconvnode.create_internal(
|
ctypeconvnode.create_internal(
|
||||||
cderefnode.create(
|
cderefnode.create(
|
||||||
caddnode.create_internal(subn,ctypeconvnode.create_internal(tinlinenode(n1).left.getcopy,voidpointertype),
|
caddnode.create_internal(subn,ctypeconvnode.create_internal(tinlinenode(n1).left.getcopy,voidpointertype),
|
||||||
cordconstnode.create(sizesinttype.size,sizesinttype,false))
|
cordconstnode.create(lentype.size,lentype,false))
|
||||||
),sizesinttype
|
),lentype
|
||||||
),
|
),
|
||||||
cordconstnode.create(len,sizesinttype,false))
|
cordconstnode.create(len,lentype,false))
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user