* fixed array[..] of char <op> pchar: wrong type was determined for non op<>+ returned

git-svn-id: trunk@1107 -
This commit is contained in:
florian 2005-09-18 08:59:20 +00:00
parent 21cc9597f2
commit fa1575aeab
3 changed files with 29 additions and 12 deletions

1
.gitattributes vendored
View File

@ -4971,6 +4971,7 @@ tests/tbs/tb0490.pp svneol=native#text/plain
tests/tbs/tb0491.pp svneol=native#text/plain
tests/tbs/tb0492.pp svneol=native#text/plain
tests/tbs/tb0493.pp svneol=native#text/plain
tests/tbs/tb0494.pp -text
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain
tests/tbs/ub0119.pp svneol=native#text/plain

View File

@ -1085,20 +1085,24 @@ implementation
inserttypeconv(right,left.resulttype);
end;
end
{ compare pchar to char arrays by addresses like BP/Delphi }
else if ((is_pchar(ld) or (lt=niln)) and is_chararray(rd)) or
((is_pchar(rd) or (rt=niln)) and is_chararray(ld)) then
begin
if is_chararray(rd) then
inserttypeconv(right,charpointertype)
else
inserttypeconv(left,charpointertype);
end
{ pointer comparision and subtraction }
else if (rd.deftype=pointerdef) and (ld.deftype=pointerdef) then
else if ((rd.deftype=pointerdef) and (ld.deftype=pointerdef)) or
{ compare pchar to char arrays by addresses like BP/Delphi }
((is_pchar(ld) or (lt=niln)) and is_chararray(rd)) or
((is_pchar(rd) or (rt=niln)) and is_chararray(ld)) then
begin
{ convert char array to pointer }
if is_chararray(rd) then
begin
inserttypeconv(right,charpointertype);
rd:=right.resulttype.def;
end
else if is_chararray(ld) then
begin
inserttypeconv(left,charpointertype);
ld:=left.resulttype.def;
end;
case nodetype of
equaln,unequaln :
begin

12
tests/tbs/tb0494.pp Normal file
View File

@ -0,0 +1,12 @@
{ the test checks only if the syntax is possible }
var
ca : array[0..1000] of char;
p1 : pchar;
begin
p1:=nil;
if (ca-p1)=0 then
halt(1);
p1:=ca;
end.